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.
Related
I use Python in Fedora 19. I wanted to run the following line:
import shapely.geometry
but the following error appears:
OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']
I installed the package Shapely, and the following two libraries:
glibc-2.17-4.fc19.i686.rpm
geos-3.3.8-2.fc19.i686.rpm.
What can I do to solve the problem?
Installed shapely using pip, and had the same problem. So I went ahead and installed it like so:
sudo apt-get install libgeos-dev
And it worked. I'm running Ubuntu, so if you're on Fedora, you should run:
sudo yum install geos-devel
On MACOS you can run:
brew install geos
set the LD_LIBRARY_PATH, then run python
export LD_LIBRARY_PATH=/path_to/geos/lib:$LD_LIBRARY_PATH
python mytest.py
Shapely loads geos via ctypes.
Try this in your python and see if you get anything:
from ctypes.util import find_library
find_library('geos_c')
If it doesn't work, then your geos installation is probably messed up. According to this, your geos should be in /usr/lib/libgeos_c.so.1. Is your library actually there?
In ubuntu, the following commands should take care of it.
It all goes down to the following packages.
(Original 2017)
sudo apt-get install libgeos-c1 libgeos-3.4.2
EDIT: (updated versions 2020)
sudo apt-get install libgeos-c1v5 libgeos-3.7.1
I am using Linux (Red Hat) and I got this error:
OSError: /home/[user]/.conda/envs/ox/lib/libgeos_c.so: cannot open shared object file: No such file or directory
What works for me:
conda install geos
On Fedora install geos and geos-devel
sudo yum install geos geos-devel
If you're using Anaconda like I am and ran into this, copy the libgeos* files from /usr/lib to the anaconda/lib directory and try again... :) Hopefully this saves someone else, cause I have spent hours on this.
brew install geos
Just this installation solved my issues.
I had no problem on Jupyter Notebook but when I used PyCharm I encountered this issue.
Tried multiple things windows on machine and the below troubleshooting steps fixed the issue
pip install geos
Go to PyCharm, File->Settings->Project->Project Interpreter(Check you have the right path where your python.exe file is there)->Add
Check that, on Virtualenv Environment -> Base Interpreter pointing to the right location where you have the python.exe
Same for System Interpreter->Interpreter
And also Pipenv Environment -> Base Interpreter
Make sure all are pointing to the right path. I encountered this problem as I have multiple IDE and hence multiple directories where python.exe is available.They were pointing to incorrect directories.
During the troubleshooting I also uninstalled and re installed conda install shapelyas I am pointing to Anaconda directory from PyCharm. Hope it helps.
Below link is also helpful https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html#conda-package-manager
I had still issues after installing geos. What solved it for me (macOS 13.1) was
sudo kmdir /opt/local
sudo ln -s /opt/homebrew/lib /opt/local/lib
to let Shapely find libgeos_c.dylib in one of the locations it was willing to look for it.
Source
I had the same problem, and to solve it, you need to add the lib path to ld.so.conf file.
To do this, Open the file:
sudo vi /etc/ld.so.conf
add this line
/usr/local/lib
And then
sudo /sbin/ldconfig
If you have macos, you should run:
brew install geos
Source distributions
If you want to build Shapely from source for compatibility with other modules that depend on GEOS (such as cartopy or osgeo.ogr) or want to use a different version of GEOS than the one included in the project wheels you should first install the GEOS library, Cython, and Numpy on your system (using apt, yum, brew, or other means) and then direct pip to ignore the binary wheels.
pip install shapely --no-binary shapely
If you've installed GEOS to a standard location, the geos-config program will be used to get compiler and linker options. If geos-config is not on your executable, it can be specified with a GEOS_CONFIG environment variable, e.g.:
GEOS_CONFIG=/path/to/geos-config pip install shapely
After following this article: How do I install pip on Windows? on my Windows system using Enthought Canopy 64 Bit system, I cannot get pip or easy_install to work due to error:
pip install requests
failed to create process
I tried re-installing setuptools, running cmd prompt as admin without any effect.
When I encountered this, it was because I'd manually renamed the directory python was in. This meant that both setuptools and pip had to be reinstalled. Or, I had to manually rename the python directory to what it had been previously.
It will help after changing the PATH to python in environment variables:
python -m pip install --upgrade pip --force-reinstall
Just ran into this. Sort of. Pip worked for me, but after installing pytest-watch, running the ptw script was giving this error.
For some reason, pip stopped quoting the #! in ptw-script.py:
#!C:\Program Files (x86)\Python\python.exe
It worked after I added quotes manually:
#!"C:\Program Files (x86)\Python\python.exe"
I don't really know why this suddenly started happening. Adding this here in case anyone else coming here from Google runs into the same thing.
Here's a related pip issue (I think).
If you intentionally want to rename the folder where python.exe resides, you should also modify all python files in the Scripts folder. So a third solution would be to modify the python files as well: the first line in pip-2.7-script.py originally contain:
#!C:\OriginalPythonDir\python.exe
Modifying this path to the new Python folder fixes the problem.
(P.S. Unfortunately I cannot yet reply to answers, so I'll reply as a new answer because I thought it could be useful for other people as well).
To fix this error (after you change the folder where python is installed) run force-reinstall for pip and pyinstaller, like this:
python -m pip install --upgrade pip --force-reinstall
python -m pip install --upgrade pyinstaller --force-reinstall
I ran into this bug while installing an older version of Python (3.5.2) for compatibility with some aws-adfs scripting. I installed aws-adfs with pip, on Windows 10, and found that while Python is installed to a directory path with spaces in it you will get the failed to create process error.
The pip maintainers say that it was a deeper problem with setuptools and even offered a workaround if you want to patch the installation in place.
But another, easier solution if you're working with older versions of Python is just to reinstall Python to a directory without spaces.
When I came across this problem, I found that my path contained multiple entries for Python. After tidying up my path so that it had an entry for the python installation folder and the scripts folder (in my case C:\Python27 and C:\Python27\Scripts), pip worked properly.
Test this. it's worked correctly for me:
python -m pip install --upgrade pip --force-reinstall
I just use python in the command shell on Windows 7 and had this problem immediately after installing pip. In case the above solutions don't help you, you should check that the folder that pip.exe is installed in (in my case, the Script folder under Python32) is in the Path.
I had installed Anaconda and so I still had C:\Python27 along with C:\Anaconda in my path. When I removed C:\Python27 and all subfolders I was able to use pip again.
Please check out have you ever rename your python.exe
I install python2 and python3 on my PC at the same time , so I rename my python.exe to python3.exe.And when I use pip ,it boom...
After rename it back .It's ok again....
Running command prompt with administrator privileges worked for me.
I had the same problem and none of the above worked for me.
I deleted my venv. And created a new one by specifying the python path:
virtualenv --python C:\Path\To\Python\python.exe venv
.\venv\Scripts\activate
and this worked
Check whether the pip-script points out the exact location of python.exe, because pip always points (C:\python3.3\python.exe). In my system i've installed 2 versions of python i.e python2 & python3. I ve modified the home application of python.exe into python2.exe and python3.exe.
When i installed pip windows installer. it results me out with the error " failed to create process"
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
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.
I've installed python 2.6 from source, and somehow later mistakenly installed another python 2.6 from a package manager too.
I can't find a way to uninstall a python that was built from source, is this possible/easy?
Running ubuntu 10.04.
You can use checkinstall to remove Python. The idea is:
Install checkinstall
Use
checkinstall to make a deb of your
Python installation
Use dpkg -r to
remove the deb.
See this post for more details.
PS. Note that Ubuntu must always have at least one installation of Python installed, or else major pieces of your OS stop working. Above, I'm assuming it's safe to remove the Python built from source, without removing the Python that was installed by the package manager.
PPS. If you accidentally erase all Python installations from your Ubuntu machine, all is not lost. Instructions on how to recover from this situation can be found here.
I did the following and reinstall using 'make install' and it worked.
whereis python3.6
rm -rf /usr/local/lib/python3.6
rm -rf /usr/local/bin/python3.6*
make install
Have you looked into
make uninstall
I believe this should work for you, assuming you have the python 2.6 source and the make file has uninstall available (it should).
http://www.linuxquestions.org/questions/linux-newbie-8/source-uninstall-with-make-uninstall-howto-230225/
In the future it may be prudent to use sudo checkinstall.
Below command removed all the things it installed for me.
make -n install
Do you still have the source directory where you compiled Python before? If so, you can CD into that directory and run sudo make uninstall.
If you don't have it still, you could re-create it by going through the build steps again--download, extract, configure, and make--but end with sudo make uninstall instead of sudo make install, of course.