Python pip install error - python

I have just installed Python 3.4.3 on my MAC (Yosemite). I need to install a couple of lxml, however everytime I type in: pip install /""/, I get error messages.
I have followed multiple tutorials and pip is installed.
MAC already had Python 2.7., but I installed the 3.4.3. version, not sure if that is the issue.
The error message is:
Brunos-MacBook-Pro:~ BrunoPaesLeme$ pip install /Macintosh HD/Users//Downloads/pycairo-1.10.0-cp27-none-win_amd64.whl
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/commands/install.py", line 268, in run
wheel_cache
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 268, in populate_requirement_set
wheel_cache=wheel_cache
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 207, in from_line
wheel_cache=wheel_cache)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 66, in init
req = pkg_resources.Requirement.parse(req)
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2960, in parse
reqs = list(parse_requirements(s))
File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2891, in parse_requirements
raise ValueError("Missing distribution spec", line)
ValueError: ('Missing distribution spec', '/Macintosh')
Anybody knows what I could be doing wrong? Any help would be appreciated.

try:
easy_install pip
pip install /"filepath"/

I have similar issue with pip install. However, if I do "sudo su -" then do my pip install 'fileName', that solve the problem for me.

Related

After upgrading pip, it no longer works

I recently updated my Homebrew installation of Python 3.8.2 to 3.8.3. After doing so, I ran
$ pip3 install -U pip
in order to check for any pip updates. It updated my installation of pip from 20.0.2 to 20.1.1, and ever since I ran that command, pip throws an error any time I try to use it. Here's the error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 584, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 20.1.1 (/usr/local/lib/python3.8/site-packages), Requirement.parse('pip==20.0.2'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/opt/python#3.8/bin/pip3", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3255, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3238, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3267, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 586, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 599, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
It seems that something went wrong during the upgrade process that failed to change the version check within the code. I saw this similar question, but the accepted answer is not working for me. How can I make pip usable again?
As per Python documentation, the correct way to use pip now would be via the correct Python executable, e.g.
python3 -m pip install -U pip
I had experienced a similar problem on my Ubuntu and here's how I solved my problem:
First restore the older version by reinstalling it from your OS package manager (You may need to uninstall first).
Upgrade to the latest version for your user (as opposed to installing in a system location) with the following command
pip3 install --user -U pip
Hope this helps.

How to install python module extras with pip requirements.txt file

The pip requirements.txt documentation says that extras may be installed using a line like
MyPackage==3.0 [PDF]
So in my requirements.txt file I have a line that reads:
requests==2.9.1 [security]
but instead of installing the security extras for the requests module when I run the command:
pip install -r requirements.txt
I get an error message suggesting that the format of my file is incorrect:
Invalid requirement: 'requests==2.9.1 [security]'
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 77, in __init__
req = pkg_resources.Requirement.parse(req)
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3036, in parse
req, = parse_requirements(s)
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse_requirements
"version spec")
File "/Library/Python/2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2956, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
RequirementParseError: Expected ',' or end-of-list in requests==2.9.1 [security] at [security]
Does anyone have any idea what I might be doing wrong?
The correct syntax would be:
requests[security] == 2.9.1
The linked docs seems to be for pip v1.1, while the latest stable version is v8.1. The latest docs for pip are here, but you have to click a few more links to get to the formatting specs for requirements (PEP 0508).

fig throws exception after installation

I installed fig on Arch Linux using the following command sudo pip install -U fig. After the installation was completed, I've tried to run fig --version but this gave me following errors:
Traceback (most recent call last):
File "/usr/bin/fig", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2880, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 432, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 741, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: fig==1.0.1
As it can be seen in the errors, I use python2. I also tried using python3, but I've got the same error.
Can anyone give me a hint?
You can try upgrading pip with easy_install:
easy_install --upgrade pip
Then try reinstalling fig.
I installed fig when python3 with set as default. After setting python2 as default, I've reinstalled fig and everything works now.

Python PIP Install Issues

I am using the command line to try to install pip. I am using the command line to install the file. I am using the command "python C:\Users\Lucas\Desktop\get-pip.py install" in the C:\Python27 directory. Below is the error message i receive in the error log:
Exception information:
Traceback (most recent call last):
File "c:\users\lucas\appdata\local\temp\unpacker-hpeuf5-scratchdir\pip\basecommand.py", line 134, in main
status = self.run(options, args)
File "c:\users\lucas\appdata\local\temp\unpacker-hpeuf5-scratchdir\pip\commands\install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "c:\users\lucas\appdata\local\temp\unpacker-hpeuf5-scratchdir\pip\req.py", line 1077, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "c:\users\lucas\appdata\local\temp\unpacker-hpeuf5-scratchdir\pip\index.py", line 265, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for install
Try:
cd C:\Users\Lucas\Desktop
python get-pip.py
Do not pass any parameters:
python get-pip.py
or
/path/to/version/python get-pip.py
Try this out
sudo python get-pip.py
Try doing all these activities using python3 and pip3. That worked for me

libgfortran not found when installing scipy using enthought canopy

I am trying to install scipy using enpkg in Enthought Canopy but I am getting this error:
(canopy_env) server 17:10:33 ~ $ enpkg scipy
prefix: /home/user/apps/canopy_env
Traceback (most recent call last):
File "/home/user/apps/canopy_env/bin/enpkg", line 10, in <module>
sys.exit(main())
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 746, in main
install_req(enpkg, req, args) # install (default)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 395, in install_req
_perform_install()
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/main.py", line 311, in _perform_install
enpkg.execute(actions)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 279, in execute
self.fetch(egg, force=int(opcode[-1]))
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 455, in fetch
f.fetch_egg(egg, force, self._execution_aborted)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/fetch.py", line 147, in fetch_egg
self.fetch(egg, execution_aborted)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/fetch.py", line 30, in fetch
fi, info = self.remote.get(key)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 47, in get
return self.get_data(key), self.get_metadata(key)
File "/home/user/apps/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 136, in get_data
raise KeyError("%s: %s" % (e, url))
KeyError: u'HTTP Error 404: NOT FOUND: https://api.enthought.com/eggs/rh5-64/libgfortran-3.0.0-1.egg'
I am using Canopy Express and this package is provided (see this)..
I have tried to install it from pip but, since I have not administration permissions, I am unable to install it..
Edit: the same happens with Pygments package when installing ipython:
appinst-2.1.2-1.egg [fetching]
55 KB [.................................................................]
MarkupSafe-0.18-2.egg [fetching]
26 KB [.................................................................]
...
KeyError: u'HTTP Error 404: NOT FOUND: https://api.enthought.com/eggs/rh5-64/Pygments-1.6.0-1.egg'
Thanks
a few of our free packages had been flagged as "commercial" by mistake. We fixed the problem and you should be able to install them now.
Sorry about the trouble!

Categories

Resources