pip issues - mac os 10.7.5 - python

I've been struggling for a while trying to get pip to work correctly.
I have (I think) successfully installed pip, and when I run 'sudo pip install --upgrade setuptools,' I get the message that setuptools is up to date.
When I try to install a package, however, (in this case redis), I get the following error message:
error: invalid command 'egg_info'
In addition, the following is also printed:
Command python setup.py egg_info failed with error code 1 in /private/var/folders/lf/c8q5s8nd3h726l_x165442d80000gn/T/pip_build_Cbelden/redis
Storing debug log for failure in /Users/Cbelden/Library/Logs/pip.log
(Possible) Clues:
When running the 'which' command I noticed both pip and easy_install are in /usr/local/bin/ but python is in /usr/bin/. Could this cause some issues? Any help is appreciated.
As of now, there seem to be two Python installations in both /Library/Frameworks and in /System/Library/Frameworks (I do not know if this is normal or not).

I backed up my system and upgraded to Mavericks. Whatever the new default Python distro is cleaned up any sort of crap I had installed earlier. I had an enthough distribution installed, which I think was the cause of my issues. pip now works successfully.

Related

Error "Invalid version: '0.23ubuntu1' (package: distro-info)"

Originally, my app crashed with error ERROR: Failed building wheel for pycairo (in the picture)
Failed to build pycairo
I tried to fix it by running several commands
sudo apt install libcairo2-dev
sudo apt install cloud-init
Gave the same error. No fix.
then I tried uninstalling the requirements.txt and reinstalled
pip uninstall -r requirements.txt
pip install -r requirements.txt
Did not solve the issue.
then I tried the below command, but I still got the same error "Failed building wheel for pycairo":
pip3 install --upgrade pip (from this thread: ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
then I tried this command:
pip install --upgrade pip setuptools wheel
and I got this error in the picture: "Invalid version: '0.23ubuntu1'"
Invalid version: '0.23ubuntu1'
I tried to also delete this package but it's showing that package not found:
command I used: sudo apt-get remove distro-info
Error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'distro-info' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 283 not upgraded.
I searched for solutions but did not find any regarding the error "Invalid version: '0.23ubuntu1'". Now, when I run "flask run", I get error: -bash: /home/ktai/.local/bin/flask: No such file or directory
Would appreciate any help!
I tried several command lines but nothing worked
I learned from this answer that there is a "bug" with versions of setuptools causing this specific Invalid version: '0.23ubuntu1' error.
Despite seeing errors with all sorts of pip commands including pip install, I was surprised to see that this downgrade command (from the answer linked) appears to resolve the issue:
pip install --upgrade --user setuptools==58.3.0
Are you using ubuntu 20.04 by chance?
I had a similar issue but it had to do nothing with pycairo so the situation might be different for you.
The existence of distro-info (with a version not compliant to PEP-440) among my Python packages was leading to the error message from your post's title whenever i tried to install another package.
For me, this one helped: (so you were close with the apt-get remove...)
python3 -m pip uninstall -y distro-info
In my case, it seems like it didnt break anything important so i will keep it like this.
But there is no guarantee the same works for you as well. Also, you might get it back the next time you install packages from your requirements.txt file.
If I understood this thread correctly, there might be updates with a compliant version of this package depending on which Ubuntu version you are using.
This error arises from PEP 440 (Python Enhancement Proposal #440), which enforces conventions for naming of Python packages, and this error seems to really only happen on Debian-based distros like Ubuntu. For example, I have been trying to install a package via pip and get an error:
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.1build1' (package: distro-info)
So it's telling us that 1.1build1 is an invalid version name per PEP 440, and it's probably getting the distro-info package from, in my case, Ubuntu (came preinstalled).
I can get around this by using a Python virtual environment and not allowing it to use system-site-packages, sometimes called "global packages".
The solution is to remove the offending package and reinstall a version of it that meets PEP 440 requirements (e.g. following the "0.0.0" convention. "1.2.0" for example is fine, "1.2build3" is not).
pip uninstall -y distro-info
pip install distro-info==1.0
Additionally, within PyCharm, I can navigate to the Python Interpreter settings, choose the interpreter I am using from the Python Interpreter dropdown, and confirm that the version of distro-info it's trying to use is 1.1build1. To "upgrade" this to 1.0, I can double-click on the "1.0" under the "Latest Version" column and select "Install Package" from the modal that pops up.
If this or the above command to remove distro-info isn't working, you can use this same window to remove distro-info and then simply run pip install distro-info==1.0.
Thank you for all the answers. To answer my own question, I was finally able to fix the issue by updating all the required packages.
Now there are no updates needed, and the app works again.
0 updates can be applied immediately.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Can't install MySQL-python [CentOS]

I need mysql-python on my CentOS 7 server to run a script I wrote. I haven't found any success installing it I always get the following error:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-
build-mpl_yksf/mysql-python/
I am running CentOS 7 and accessing my machine through ssh.
I have tried the following:
-Installing mysql-python on Centos
-can't install MySQL-Python
python-dev is installed hopefully for the right version of python, gcc is also installed in fact I run:
# yum groupinstall "Developper Tools"
-mysql_config not found when installing mysqldb python interface
Tried the solution provided here to install the package directly in the same directory as python 3.7 instead of the default one which was the one containing python 2.7:
https://unix.stackexchange.com/questions/323532/yum-install-package-name-to-different-directory
I
# yum --installroot=/usr/local/bin/ --releasever=/ install MySQL-python
Per this I can't simply uninstall python 2.6:
-How to uninstall Python2.6
And I don't think simply creating an alias will solve my problem generally python 3 launches automatically not python 2 but my problem is regarding mysql-python
Essentially I think I have narrowed it down to the fact that I don't have mysql-python accessible to pthon 3.7 for some reason. It seems my 2 versions of python are somehow conflicting. I am wondering what I can do to fix this ? Before you suggest I tried running my program through python 2 but some exceptions I have to catch were not yet available.
All I want to do is get rid of this error message:
ModuleNotFoundError: No module named 'mysql'
Could someone please help me ? I wasn't sure whether it was better to post in unix.stackexchange.com but it seems appropriate to stackoverflow
The error you are getting (Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mpl_yksf/mysql-python/) is because of a missing package ConfigParser.
In Python 3, ConfigParser was renamed to be configparser (all lowercase) to comply with PEP 8 standards. As of now, MySQL-python has not been updated to support Python 3.
You are left with two choices:
Use Python 2 for whatever you are trying to do. This implies using pip2 command instead of pip3.
Use an alternative package, such as mysqlclient.
To install mysqlclient, you will first need libmysqlclient-devel. Then you can install the Python 3 module via pip.
$ pip3 install mysqlclient

unable to install pip on windows 10

I am a new python user and am trying to install pip by using "python get-pip.py install" in the command prompt but end up with this error message:
"Could not find a version that satisfies the requirement install (from versions:)
No matching distribution found for install"
I have Python 2.7 and Windows 10. Image link below shows error message and web link shows code that I copied into the get-pip.py file. Is there some other install for pip for a different version...?
image of error message
https://bootstrap.pypa.io/get-pip.py
As the other answer notes the issue may be due to your path. However i would reccomend just using chocolatey:
https://chocolatey.org/
This is a package manager that handles a lot of things for you. Once you install chocolatey (very simple installation). You can go ahead and type choco install pip in a command window. This should handle the installation of pip for you. It can also be used for many other things, i.e. anaconda, python itself, and much more.
I think you are facing this problem because you haven't added python to Path Environment Variable.
You do that and things will be smooth.
As far as this problem is concerned
Open command prompt in the folder where you have downloaded 'get-pip.py.' file (shift + right click)
then run 'python get-pip.py'

Python 3.x - Error while installing packages using pip

I've got a problem while I want to install couple packages for python 3.4.
The problem appears while I want to type pip. Any commands after word pip, easy_install are giving the same error. Installed get-pip.py before but the error still occurs:
C:\Users\Konrad>pip
Fatal error in launche: Job information querying failed
I'm running windows10 x64. The cmd was in admin mode.
Aby suggestions? I typed that error message through google, but there weren't any helpful answers.
Running python just works and launches Python 3.4.3.
That doesn't look like the Python pip command. You have a different pip executable in the way somewhere.
Use python -m pip as a work-around; it'll use Python to find the module and use it as a command-line tool (which is explicitly supported):
python -m pip install <something>

pip install matplotlib fails on mavericks with homebrew

I am trying to install the Scipy python stack, but having issues.
I have a new mac os with mavericks (10.9).
I have installed homebrew and am using brew to manage installations.
I used
% brew install python
then (I verified pip is from my homebrew installation)
% pip install numpy [this works]
% pip install scipy [this works]
% pip install matplotlib OR pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz
Both fail with the same error. After checking the backend, I get
Fatal Python error: PyThreadState_Get: no current thread
The error message from mac os X (the pop up error window) shows errors very similar to those in the previous thread
Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik
It seems I need to fix the python bindings, as some of them linked against the /System/Library python that ships with the mac. What is not clear to me from the above post is
which of the Binary Images need to be "re-linked"? all of them? some seem quite general an not related to matplotlib
how do I actually use install_name_tool to fix the link? As I mentioned, some seem quite general - do I really want to change the path? Do I cp the dylib from old to new?
I have also tried
brew uninstall python
and re-brewing, all to get the same error. I am trying not to use EPD because EPD installs its own libxml2 and others, which I need for other software I will install, and this has caused me problems on an old machine. I am open to considering a virtualenv, but was hoping to learn to just fix my current problem if possible.
Thanks,
Andre
PS, when pip install matplotlib`, the following warning appears, which seems odd because matplotlib is such a staple piece of software
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
This is an issue in pygtk. You can test it with brew (it should throw the same error):
brew test pygtk
I ran into the same problem, and got past that error with the following steps from https://github.com/mxcl/homebrew/issues/13654
brew rm py2cairo
brew install py2cairo
You can test that pygtk is working using brew test pygtk again.
I'm still having other problems getting pip install matplotlib to work, so you may also run into more problems, but that should get you past that particular issue.
I had the same problem, and after some experimentation it seems that installing under Python 3 works more reliably. i.e. this installed without error:
pip3 install matplotlib
I then had to re-install everything else using pip3, and make sure I was running under python3 at execution time.
brew install freetype
it works on mac os sierra!

Categories

Resources