Python: _socket.so - python

Greetings!
So I'm creating a Python script that will when finished be compiled with Shedskin. Currently we do a little FTP work in this script so we import the ftplib module. When I attempt to compile it with Shedskin we get the error back saying that there is no '_socket' file in our Python2.6 installation on Ubuntu. I've checked myself in the '/usr/lib/python2.6/lib-dynload' dir to confirm that yes there isn't any file entitled '_socket.so' present in that folder.
I've tried reinstalling the python2.6 package in Synaptic but to no avail.
What should I do?

Look for shdeskin supported library modules in
/usr/lib/python2.6/site-packages/shedskin/lib/.
My Fedora installation of shdeskin 0.7 does not include ftplib.

Related

Pyinstaller on Msys2 with pygobject

I have been building an application on Linux using python pygobject, and now I need to distribute it on Windows.
I first installed pygobject via msys2 (as per the official pygobject documentation)
Now, using msys2/mingw32, I can run my program typing
python3 main.py
But when I try to freeze it into a .exe with Pyinstaller, and try to run the produced .exe
If I Don't use --onefile, I get an import error on the _struct module (whereas "import _struct" works in python shell)
If I use --onefile, I get the Following error :
error:
lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll could not be extracted!
fopen: No such file or directory
I’m using the devel version of Pyinstaller. I know next to nothing on Windows OS… does anyone know how to fix that error ?
It sounds like you were on the right path, unfortunately you ran in to a bug in PyInstaller. The good news is that the issue with the No module named '_struct' error is now fixed and released in version 3.6 and later. I would recommend using the --onedir mode of PyInstaller, you should be able to successfully package a GTK app for Windows.

how to build .exe for python 3.5+, 3.6 if possible?

Is there now an easy protocol to build a .exe from python 3.5+, using modules pyqtgraph, qt5, theano, pymc3, numpy, scipy, os and sys, and opening a simple GUI stored in a '.ui' file ? I lost hours and eventually failed to make one (for w7-64 bits). Help !
preliminary failure with py2exe: I first install py2exe for python 3 but it turns out this is not compatible with my python 3.6 yet, so I downgraded to python 3.5… to get a bunch of errors. Then I went to forums and tried the proposed cures but failed (I’m uneasy with windows), the alternative being to downgrade to python 3.4… So I downgraded to python 3.4 to get an error concerning a missing ‘msvcr100.dll’ that I tried to install following instructions on forums but by default I don’t have the permission to modify system directories… When I eventually had this permission it turns out the ‘regsvr32’ command fails (isn’t this for 32 bits ? but there is no ‘regsvr64’…). Following episodes are described below.
update august 23, 2017, 1pm:
I also tried pyinstaller as advised but it failed (see my related question build a .exe for Windows from a python 3 script importing theano with pyinstaller)
I also tried cx_freeze but it failed (see my related question build a .exe for Windows from a python 3 script)
I also tried pynsist but it fails (same link than above)
what's next ?
update september, 2, 2pm:
I eventually managed to build a .exe with pyinstaller after many episodes.
Unfortunately I failed to deal with the ‘theano’ module (that is required in my case by the ‘pymc3’ module) and I had to modify the .py files and give up part of the application. Could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?
see build a .exe for Windows from a python 3 script importing theano with pyinstaller
Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with)
py -3.5 pip install pyinstaller
then go the C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts
and run the command
pyinstaller <code .py file along with directory> --onefile
--onefile : is for compressing the build and get a single file as output
I would suggest pyinstaller see http://www.pyinstaller.org/
The pyinstaller already supports 3.5
The development version supports 3.6
It is better to use spec file to import other hidden libraries. I listed all Sklearn libraries and add them to spec file as a hiddenimports, you can add libraries you used in your project.

How to install mesos.native python module in Mac OS and Ubuntu

I would like to write and run a Mesos framework with Python, so I need mesos.native module.
On Ubuntu:
I can build mesos from source code. I tried to easy_install all the generated egg files but none of them made it possible for Python to import mesos.native.
I also tried to download the egg from http://downloads.mesosphere.io/master/ubuntu/14.04/mesos-0.20.1-py2.7-linux-x86_64.egg and easy_install it, which didn't work as well.
On Max OS:
Got some problem building the mesos source code because of the issue. So I am wondering whether there is an easy way to install the Python module without building the source code.
BTW, why don't they make the mesos.native pip-installable like mesos.interface?
Problem solved: https://github.com/RobinDong/mesos-python-examples/blob/master/calculate_pi/pi_run
I just need to set PYTHONPATH as that in the file and run python. Mesos.native can be successfully loaded.

how to install libraries in portable Python 3.2.1.1

I have installed Portable Python 3.2.1.1 on windows 8 and i also have installed pypdf2
using setup.py install command on cmd.
but when I try to import the module it is giving me an error
"import error: no module named pypdf2"
is installation on portable python different?
All efforts to make this work with PortablePython 3.2.5.1 failed. But this is the Portable Python 2.7.5.1 version of it. I did it on Windows 7! Screenshot
I downloaded PyPDF2 from https://github.com/mstamy2/PyPDF2 and extracted the folder.
I found the folder PyPDF2-master and went into it to reveal PyPDF2.
I copied the folder PyPDF2 into the path "Python 2.7.5.1\App\Lib"
I went back to Portable "Python 2.7.5.1\App" and started python.exe
I've also attached a screenshot. I hope this will also work for you.

ubuntu - bz2 not available (/usr/bin/python older version, so am using /home/name/somedir for python

My server has python older version(2.6~), so I have created a separate dir for installing latest python. I have installed from binary .
Now, got error that 'bz2 module is not available'
got this problem when installing django-celery.
it is actually working from system level python like this:
/usr/bin/python:
python shell opens......
then, import bz2; works !!!
python (means, locally installed python, after source /venv/bin/activate)
in python shell, import bz2; says that it is not available. Can you please make it work for my local version( not global one).
Resources I found and tried from :
ImportError: No module named bz2 for Python 2.7.2
Python's bz2 module not compiled by default
A very similar question describes the same problem but for zlib. In short, you'll need libbz2.so and its headers in some location where Python can find them. You might need to download the bzip2 source code and compile/install that in your homedir as well.

Categories