cannot locate pip.pm for installing python modules - python

I'm having trouble installing the regex module for python, and would appreciate any suggestion and help. When I used "pip install" on a Windows system, the following error shows up:
Can't locate pip.pm in #INC <#INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at C:\pathA\pathB\perl\bin/pip line 5.
BEGIN failed--compilation aborted at C:\pathA\pathB\perl\bin/pip line 5.
All I did previously is to install pip, following this post: How do I install Python libraries?
I succeeded in the following steps:
python ez_setup.py
python get-pip.py
but not:
pip install setuptools --upgrade
that is when I got the errors.
I am not familiar with using python on Windows, but I need to do it this time. Seems like there is another pip installed for perl on this computer, but when I check the environment variables, I can't really see anything about pip.
For your information -- the python version is:
2.7.7 |Anaconda 2.0.1 (64-bit)| (default, Jun 11 2014, 10:40:02) [MSC v.1500 64 bit (AMD64)]
Thanks a lot in advance for your help!

Apparently Perl also has a tool named pip. Your PATH variable contains the directory for Perl's pip before the one containing Python's pip. You need to find the location of Python's pip and run it directly using an absolute path or edit the PATH variable for Windows so that the directory containing Python's pip is before the directory containing Perl's pip.

The answers is perfect. Just a addon: you can do that by
Right click on the start button
Go to system> Advanced system settings> Environment Variables
In system variables select path and then click on edit
Reorder paths so that C:\Python27 entry comes before the perl\bin
entry
Save your changes by clicking ok

Related

Python 3; pyexiv2 v.2.7 can't load exiv2.dll, although it's there

Encountering an JPG image which wouldn't load with pyexiv2 v2.6.4, I upgraded to pyexiv2 v2.7, via pip install, which went through without complaints.
Now pyexiv2 doesn't load at all anymore, complaining
FileNotFoundError: Could not find module 'C:\Program Files\Python\3.8\lib\site-packages\pyexiv2\lib\exiv2.dll'. Try using the full path with constructor syntax.
The file exists (os.path.exists("...")==True just before the _dlopen() throwing the exception), and was just installed fresh with the package. I am running "Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32".
Any ideas? Thanks!
EDIT: Two more bits of information:
I vaguely remember that when installing the previous pyexiv2 version, the installation compiled something called exiv2. This did not happen during installing pyexiv2 v2.7. Although I do find only the windows subdirectories in the install directory.
Replacing v2.7 by v2.6.4 again (from a safety copy :-) does not help - now it's broken as well :-(
Looking at Python docs for the ctypes module, I saw a hint that maybe it's a problem with additional libraries required by exiv2.dll.
After installing "Visual Studio 2022 Release Candidate" from Visual Studio Download (be sure to check the "build tools" checkbox when the installer asks for what to install), all is well again.

Fatal error in launcher: Unable to create process using '"' in python

I had python 2.7 before and then I installed python 3.4.The OS is windows 10
I have renamed
C:\python27\python.exe to python2.exe (when I run python2 --version it shows correct version)
and
C:\python34\python.exe to python3.exe (when I run python3 --version it shows correct version)
I have set the path variable manually and there is no space etc.
I was trying to create a virtual environment and assign python34 to this new environment.
I was going through this SO reference -- Using VirtualEnv with multiple Python versions on windows
prompt>> virtualenv -p c:\Python34\python3.exe casenv
But I got an error--
Fatal error in launcher: Unable to create process using '"'
Do I need to install virtualenv again for python34 or somewhere I need to set virtualenv path for each python installation.
Any help is highly welcomed.
In my case, i had installed python 3.6 and uninstalled python 2.7 when i got this error.
Completely deleting the C:\Python2.7 directory did the trick.
This error is usually caused because of python directory of different versions stored at same location.
i.e in my case I was using python 3.5.X for development and when I updated to 3.7.6 I got this error.
People on internet suggest that it is because of pip but main cause is 2 or more python directory.
The following steps should fix it:
Uninstall previous python version (or use virtual environment if you want to play with multiple python version)
Delete the python directory you are not using (as it causes confusion for terminal to understand which python path it should pick to execute the command)
and this should fix the error of
fatal error in launcher unable to create process using ' '
Pip version: 10.0.0
Python version: 3.6.5 64 bit
Operating system: Windows 7 Ultimate, Service Pack 1, 64-bit
Description:
After upgrading pip to the version 10.0.0 (from Pycharm, that is using pip as a package) any attempts to start updated pip cause an error:
Fatal error in launcher: Unable to create process using '""c:\program files\python 3.6\python.exe" "C:\Program Files\Python 3.6\Scripts\pip.EXE"'
Command python -m pip works as expected.
I found text "Fatal error in launcher" only in executables:
src\pip_vendor\distlib\t32.exe
src\pip_vendor\distlib\t64.exe
and in the pip.exe itself.
After
python -m pip uninstall pip
easy_install.exe pip
error disappeared.
It is interesting, that initially pip.exe had almost the same size as t64.exe, now it significantly shorter.
If someone came after installing a newer version like 3.X and uninstalled the older version, what you need to do is to delete the old version's folder from C Drive.
Clean Fix (Windows)
The fastest way to fix the issue you were facing is to uninstall and reinstall.
Why it happened?
You probably moved the directory where python was installed.
You probably have both environmental variables listed in Environmental Variables.
Things to consider
You can only use 1 active version of python at a time if you use the MSI installer.
If you downloaded the zip file of Python, you can have unlimited versions in your computer BUT you can only have 1 active version under Environmental Variables.
You can always use any version of Python explicitly by writing the direct path to the specific location of the version of Python.

Install Matlab Engine for Python 3.4.5

I need to install the Matlab engine for Python 3.4.5 in an Anaconda environment.
When I try to install the Matlab engine with the following command:
sudo python setup.py install --prefix="/home/<<my user>>/anaconda3"
It creates another folder named python2.7 and inside it creates all the necessary files and folders:
/home/<<my user>>/anaconda3/lib/python2.7/site-packages
When I run which command and the python one they return
which python
/home/<<my user>>/anaconda3/bin/python
python
Python 3.4.5 |Anaconda 4.3.0 (64-bit)
So the system points towards the correct Python version
I even check what version the setup.py finds and it is 3.4
What do I miss?
Cheers,
Dan
I don't know what exactly the issue is, can you import the matlab engine?
If it doesn't work most likely the problem is when you install the engine on a different python environment (in this case the one from Anaconda), you need to link the library from this environment.
On linux you can do:
export LD_LIBRARY_PATH="/home/<<my user>>/anaconda3/lib:$LD_LIBRARY_PATH"
On Mac:
export DYLD_LIBRARY_PATH="/home/<<my user>>/anaconda3/lib:$DYLD_LIBRARY_PATH"
That should work, otherwise you can follow this link.

Eclipse with Python - having difficult with python version being picked up for egg file creation

I am using CentOS with Python 2.6 (/usr/bin/python2.6) but I installed Python 2.7.8 (/usr/local/lib/python2.7).
The egg files (on running a script on eclipse get created /usr/bin/python2.6/.. for the wrong version. I want it to get created in /usr/local/bin/python2.7/..
[code] [Desktop]$ which python
alias python='python2.7'
/usr/local/bin/python2.7 [/code]
The site-packages are present in /usr/local/lib/python2.7/site-packages
I have set the .bashrc file and PYTHONPATH to point to Python2.7 and checked output of "python -v" and "which python" which seems correct.
Is there something else that I could be missing? I always keep getting this error saying "no module named pkg_resources" found as a result of all this.
Thanks Lafada:
yum install python-setuptools
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/usr/local/lib/python2.7/site-packages/cStringIO.so: undefined symbol: PyCapsule_New
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
This clearly explains that there is some version issue/mix-up.. would you know about this?
Update:
I found something on stackoverflow which helped me on 2 packages but not the others. I see the following on my Python Interpreters.
[code]
/usr/local/lib/python2.7/site-packages/setuptools-5.4.1-py2.7.egg
/usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
/usr/lib/python2.6/site-packages/nose-1.3.3-py2.6.egg
/usr/lib/python2.6/site-packages/six-1.3.0-py2.6.egg
/usr/local/bin/python2.7
/usr/local/lib/python2.7/site-packag`enter code here`es
/usr/lib64/python2.6
/usr/lib64/python2.6/plat-linux2
/usr/lib64/python2.6/lib-dynload
/usr/lib64/python2.6/site-packages
/usr/lib64/python2.6/site-packages/gtk-2.0
/usr/lib64/python2.6/site-packages/webkit-1.0
/usr/lib/python2.6/site-packages
/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info
[/code]
I need the packages referencing py2.6 to refer to py2.7 and create egg files for 2.7.
You have to install python-setuptools
apt-get install python-setuptools
This will install pkg_resources module
Hi Lafada:
I have responded to your comment by editing my question.
Doing an "make altinstall" helped me and following http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/ was helpful.
For those modules that were still using py2.6, I re-installed them with pip by using "pip-2.7".

Installing python-ldap in a virtualenv on Windows

I'm working on a Django project that is using an ldap authentication module. This is working on our server but I am running into issues getting this running on my windows dev machine.
My environment is using virtualevn and when trying to install pip python-ldap I receive the following message:
error: Unable to find vcvarsall.bat
Does anyone have any idea what could be going wrong?
To expand on #Brandon's answer, to install using the pre-built wheel:
Ensure you have pip 19.2+ installed:
$ pip --version
pip 19.2.3
Check your Python version and architecture (32/64 bit) https://stackoverflow.com/a/10966396/1026:
$ python -c 'import sys; print(sys.version)'
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
Download the matching pre-built *.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
For example given the above Python I picked "python_ldap‑3.2.0‑cp37‑cp37m‑win_amd64.whl"
Install it with:
pip install path\to\your.whl
Unfortunately, many Python modules have trouble installing on Windows. The error you're receiving is one that I was never able to get fixed, even given the vast amount of information available on the web. Give this link a try for a pre-compiled version: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap

Categories