I've installed uWSGI using pip and start it up with an XML to load my application. The XML config contains <plugin>python</plugin>. On my new server it leads to an error:
open("./python_plugin.so"): No such file or directory [core/utils.c line 3321]
!!! UNABLE to load uWSGI plugin: ./python_plugin.so: cannot open shared object file: No such file or directory !!!
I can find the .c and the .o versions:
sudo find / -name 'python_plugin.c'
/srv/www/li/venv/build/uwsgi/build/uwsgi/plugins/python/python_plugin.c
/srv/www/li/venv/build/uwsgi/plugins/python/python_plugin.c
sudo find / -name 'python_plugin.o'
/srv/www/li/venv/build/uwsgi/build/uwsgi/plugins/python/python_plugin.o
/srv/www/li/venv/build/uwsgi/plugins/python/python_plugin.o
sudo find / -name 'python_plugin.so'
But no .so found. My previous system had a uwsgi install through apt-get, but that's really old (and I'm quite sure it uses the pip installed uwsgi normally, but maybe not for shared objects then?)
Some background info:
Ubuntu 12.0.4 LTS
Python 2.7 (virtualenv)
I've installed uWSGI in my venv, using the normal pip install uwsgi (no sudo)
So I'm a tad clueless :( I can't be the only person in the world to have this, right? Should I compile the .so objects myself? (If so, how?) Or is there another great solution?
Distros should package uWSGI in a modular way, with each feature as a plugin. But when you install using language specific ways (pip, gem...) the relevant language is embedded, so you do not need to load the plugin
For anyone that is having trouble with this, basically you need to remove lines that state your plugin from your configuration files if you change from a distro package to a pypi or gem install. I was previously using the Ubuntu/Debian package for uwsgi, but it was old so I upgraded to use pip instead.
So, in my configuration .ini file, I had the following line:
plugin = python
Removing that line fixes the problem.
Maybe you forgot this command
$ apt-get install uwsgi-plugin-python
If you're using Python3, try this command instead:
$ apt-get install uwsgi-plugin-python3
Install all available plugins: sudo apt-get install uwsgi-plugins-all
As of 6/2018 the yum package name was updated from uwsgi-plugin-python to uwsgi-plugin-python2 https://src.fedoraproject.org/rpms/uwsgi/pull-request/4#
The new install command is therefore yum install uwsgi-plugin-python2
Related
I am trying to install Python 3 on a AIX server.
I got the Python 3 RPM file for AIX from here.
There were few dependencies that needed to be installed before installing Python, but I chose to install it without having installed any dependency through nodeps.
Now when I execute a Python3 command, I get the following errors:
It says cannot load module /opt/freeware/lib64/libpython3.5m.so but the file does exists in that directory.
Both LIBPATH & LD_LIBRARY_PATH are set to lib64.
Edit: Adding the output of lslpp -L rmp.rte command
The issue has been resolved now :)
I downloaded and installed below 2 dependencies
libgcc
gettext
I need not had to downgrade RPM or install and use yum to download required dependencies.
Download 3.0.5.51 from here
After download execute the following command on the server as root:
# installp -acFXYd rpm.rte.3.0.5.51 all
This command should downgrade your RPM to 3.0.5.51 and make it usable.
I know there are already similar questions about the missing Python.h but NO solution worked for me by now.
I need Python libraries in order to use Tossim, which is a tinyOS simulator (http://tinyos.net).
Python appears to be already installed on my Ubuntu 12.04 system.
In fact whenever I run the command
$ python -V
I get the output 2.7.3
Anyway when I try to locate Python.h no file is found. Python libraries are located in usr/lib/ but no headers in the folder.
Mind that I already tried the most common solution for this problem, that is $ sudo apt-get install python-dev , and also $ sudo apt-get update.
None of them worked for me.
What should I do now? I tried to remove and reinstall python-dev, with no success. I only think to manually download and place the header into the folder usr/lib/python2.7.
But I doubt it is a good idea. Can somebody help me? Thank you in advance.`
Ubuntu (and Debian) stores Python include files in /usr/include/python2.7. If the python2.7-dev package is installed (a dependency of python-dev) then Python.h will be located at:
/usr/include/python2.7/Python.h
You can locate what packages contain the file with the command:
dpkg -S Python.h
or list what files are installed with a package with:
dpkg -L python2.7-dev
I use the package named python-snappy. This package requires snappy library. So, I download and install snappy successfully by the following commands such as:
./configure
make
sudo make install
When I import snappy, I receive the errors:
from _snappy import CompressError, CompressedLengthError, \
ImportError: libsnappy.so.1 cannot open shared object file: No such file or directory
I'm using Python 2.7, snappy, python-snappy and Ubuntu 12.04
How can I fix this problem?
Thanks
Traditionally you might have to run the ldconfig utility to update your /etc/ld.so.cache (or equivalent as appropriate to your OS). Sometimes it might be necessary to add new entries (paths) to your /etc/ld.so.conf.
Basically the shared object (so) loaders on many versions of Unix (and probably other Unix-like operating systems) use a cache to help resolve their base filenames into actual files to be loaded (usually mmap()'d). This is roughly similar to the intermittent need to run hash -r or rehash in your shell after adding things to directories in your PATH.
Usually you can just run ldconfig with no arguments (possibly after adding your new library's path to your /etc/ld.so.conf text file). Good Makefiles will do this for you during make install.
Here's a little bit more info: http://linux.101hacks.com/unix/ldconfig/
You can install the python-snappy and libsnappy1 from the ubuntu repos:
$ sudo apt-get install libsnappy1 python-snappy
You should not have to download anything.
the following worked for me:
$ conda install python-snappy
then in my code I used:
import snappy
Here for e.g. anaconda python
Download snappy from github
also download the python file
extract both files
google-snappy folder
$ ./configure
$ make
$ sudo make install
Then in python folder:
$ python setup.py build # here I get the same import _snappy error
$ python setup.py install # after this import works
I'm installing a program that requires I have python-config installed. The only problem is that I do not currently have python-config, and I cannot seem to figure out how to get it.
After searching around, I can supposedly install it via:
yum install python-devel
However, after doing so, python-config still does not exist.
I am currently using Python 2.4 on a cluster running CentOS 5.2.
Any help would be greatly appreciated!
I had the same issue running CentOS 8 with python 3.6. python3-config is installed and not python-config. you can either create a symlink or just use python3-config .
Run: pip install python-config
It would be installed and added to PATH.
Maybe it installed the file somewhere else.
First do:
which python
on command line to find where the executable file is located.
Second:
Compare the installation file folder to see if it is in the same place.
Third:
if not you can either move it to the same folder or use the executable pointed by your file by calling it from the top of your scripts.
It should look something like this:
#!/usr/bin/Python-2.7.11
Resist changing the python version of your cluster, calling it from your script with a locally installed version seems to be the best solution.
d/l from http://www.red-dove.com/config-0.3.9.tar.gz
or from http://www.red-dove.com/config-0.3.9.win32.exe
unpack and use setup.py
Jason's reply may solve your missing dependency issue though more information is required regarding how you are installing your main package which needs python-config as its dependency.
If installation is done via yum or directly from rpm files and rpm package has python-config as its dependency then even if you install python config from setup.py file missing package error wouldn't go away. In this case you may have to do force install using yum or rpm or install main application via different method.
Regards,
yum install python-configparser
FYI, if you install python3 via IUS, the equivalent python-config is /usr/lib64/python3.6/configparser.py. You may need to create a symlink by yourself.
First, please bear with me. I have hard time telling others my problem and this is a long thread...
I am using pythonbrew to run multiple versions of python in Ubuntu 10.10.
For installing pythonbrew and how it works, please refers to this link below
http://www.howopensource.com/2011/05/how-to-install-and-manage-different-versions-of-python-in-linux/
After reading a couple stackoverflow threads, I finally found the file called Setup under this directory: ~/.pythonbrew/pythons/Python-2.7.1/lib/python2.7/config
In this Setup file I see
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
# zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
I uncommented the last line, then I ran python -v again. However, I received the same error when I tried import zlib, so I guess I have to do something to install zlib into the lib.
But I am clueless about what I need to do. Can someone please direct me in the right direction??? Thank you very much!
I am doing this because I want to use different version of python in different virtualenv I created.
When I did virtualenv -p python2.7 I received no module named zlib.
jwxie518#jwxie518-P5E-VM-DO:~$ virtualenv -p python2.7 --no-site-packages testenv
Running virtualenv with interpreter /home/jwxie518/.pythonbrew/pythons/Python-2.7.1/bin/python2.7
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 17, in <module>
import zlib
ImportError: No module named zlib
EDIT
I have to install 2.7.1 by appending --force.
I am developing Django, and I need some of these missing modules, for example sqlite3, and to create my virtualenv I definitely need zlib. If I just use the system default (2.6.6), I have no problem.
To do this with system default, all I need to do is
virtualenv --no-site-packages testenv
Thanks!
(2nd edit)
I installed 3.2 also and I tested it without problem, so I guess my problem comes down to how to install the missing module(s).
jwxie518#jwxie518-P5E-VM-DO:~$ virtualenv -p python3.2 testenv
Running virtualenv with interpreter /home/jwxie518/.pythonbrew/pythons/Python-3.2/bin/python3.2
New python executable in testenv/bin/python3.2
Also creating executable in testenv/bin/python
Installing distribute..................................................................................................................................................................................................................................................................................................................................done.
Installing pip...............done.
jwxie518#jwxie518-P5E-VM-DO:~$ virtualenv -p python3.2 --no-site-packages testenv
Running virtualenv with interpreter /home/jwxie518/.pythonbrew/pythons/Python-3.2/bin/python3.2
New python executable in testenv/bin/python3.2
Also creating executable in testenv/bin/python
Installing distribute..................................................................................................................................................................................................................................................................................................................................done.
Installing pip...............done.
Sounds like you need to install the devel package for zlib, probably want to do something like
# ubuntu 12,14,16,18,20.04+
sudo apt-get install zlib1g-dev
Instead of using python-brew you might want to consider just compiling by hand, it's not very hard. Just download the source, and configure, make, make install. You'll want to at least set --prefix to somewhere, so it'll get installed where you want.
./configure --prefix=/opt/python2.7 + other options
make
make install
You can check what configuration options are available with ./configure --help and see what your system python was compiled with by doing:
python -c "import sysconfig; print sysconfig.get_config_var('CONFIG_ARGS')"
The key is to make sure you have the development packages installed for your system, so that Python will be able to build the zlib, sqlite3, etc modules. The python docs cover the build process in more detail: http://docs.python.org/using/unix.html#building-python.
By default when you configuring Python source, zlib module is disabled, so you can enable it using option --with-zlib when you configure it. So it becomes
./configure --with-zlib
For the case I met, I found there are missing modules after make. So I did the following:
install zlib-devel
make and install python again.
After running configure, you can change the config option in the file Modules/Setup as below:
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
Or you can uncomment the zlib line as-is.
I had a lot of problems making a virtual environment (venv) as described in the tensorflow installation guide.
Most of the commands listed in this post didn't help me either so, if this is also your case this is what I did:
pip3 install --user pipenv
pip install virtualenv
Installs the dependencies to create a virtual environment
mkdir myenv
Makes a new directory called myenv but you can call it whatever you want e.g. mynewenv
cd myenv
Or whatever you call your directory so: cd [your_directory_name]
virtualenv -p /usr/bin/python3 venv
Creates a virtual environment called venv in the folder myenv. You can call your virtual env whatever you like e.g. vitualenv [v_env_name]
source ./venv/bin/activate
Activates the virtual environment. Note that if you choose a different v. env. name your commands should be written as such source ./[v_env_name]/bin/activate
deactivate
Deactivates the virtual environment.
Note: I am using Python 3.6.6 & Ubuntu 18.04
source for the commands
After you install the missing zlib dev package you can also use pythonbrew to uninstall and then reinstall the version of python you wanted and it seems like it picks up the new package to compile to correct abilities. This way you can keep using pythonbrew and don't have to do the compilation yourself (though it isn't that difficult)
Similar to the answers here on CentOS or RHEL run
sudo yum install zlib-devel
The --with-zlib solutions shown here seem to be missing headers that Python 3.9 and up needs to link (in my case).
The easiest solution I found, is given on python.org devguide:
sudo apt-get build-dep python3.6
If that package is not available for your system, try reducing the minor version until you find a package that is available in your system’s package manager.
I tried explaining details, on my blog.
My objective was to create a new Django project from the command line in Ubuntu, like so:
django-admin.py startproject mysite
I have python2.7.5 installed. I got this error:
ImportError: No module named zlib
For hours I could not find a solution, until now!
Here is a link to the solution -
http://doc.biblissima-condorcet.fr/loris-setup-guide-ubuntu-debian
I followed and executed instruction in Section 1.1 and it is working perfectly! It is an easy solution.