I can't get pip2 to work.
I need pip2, because I need to use an older tensorflow version which is not supported by python3 pip. When trying to run pip2 install I get this:
Traceback (most recent call last):
File "/usr/bin/pip2", line 11, in <module>
load_entry_point('pip==20.1.1', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python2.7/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python2.7/site-packages/pip/_internal/req/constructors.py", line 21, in <module>
from pip._vendor.pkg_resources import RequirementParseError, parse_requirements
ImportError: cannot import name RequirementParseError
I uninstalled pip2 and reinstalled it. Also did the same for pip(3). But this didn't change a thing. I could not find anything useful on this error message and feel a bit helpless. Any ideas?
update forgot to mention, that I use archlinux. I installed it with pacman -S python2-pip
Did you try installing packages using virtualenv ? pacman ? or using only pip ?
Which version of tensorflow are you trying to install ?
You can try install libraries using a recent pip2 version + virtualenv using the following commands:
pacman -S python2 python2-pip python-virtualenv
virtualenv -p python2 py2
. py2/bin/activate
pip install -U pip setuptools wheel
pip install tensorflow ipython
You may also try uninstall python2 first and reinstall it from scratch:
pacman -Rs python2 python2-pip
This link suggests that the problem might be due to a version of setuptools installed in ~/.local . Maybe you can check that.
Nevermind, setuptools was installed in my ~/.local directory for some
reason, superceding the system install, I removed that and pip2 runs
fine now.
Please see this link:
https://askubuntu.com/questions/984868/error-in-installing-sudo-pip-install-v-protobuf-3-0-0a2
The library is different but the error is the same.
Related
I've recently updated Python to version 3.7 from version 3.5, and made it the default in my bash shell. I've also updated pip and made sure it uses Python3.7.
Now, whenever I try to install any module using pip I get this error"
$pip3 install google
Traceback (most recent call last): File "/home/AnnaK/.local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main File "/usr/lib/python3/dist-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python3/dist-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link File "/usr/lib/python3/dist-packages/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext File "/usr/lib/python3/dist-packages/pip/wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker File "/usr/share/python-wheels/distlib-0.2.2-py2.py3-none-any.whl/distlib/scripts.py", line 14, in <module> File "/usr/share/python-wheels/distlib-0.2.2-py2.py3-none-any.whl/distlib/compat.py", line 66, in <module> ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (/usr/lib/python3.7/urllib/request.py)
I get the same error if I try to simply run pip. This didn't happen when I was using python3.5. I did have this problem when briefly using python2.7, but I fixed it using https://askubuntu.com/questions/581999/pip-raises-importerror-cannot-import-name-httpshandler. That solution doesn't seem to work for python3.7.
I've tried to reinstall pip, reinstall python3, update my Windows Ubuntu subsystem, and reinstall libssl-dev. I'm stumped. Any help is appreciated!
You must have inadvertently upgraded your system pip (probably through something like sudo pip install pip --upgrade)
pip x.x adjusts where its internals are situated. The pip3 command you're seeing is one provided by your package maintainer and is not a file managed by pip.
You can read more about this on pip's issue tracker
You'll probably want to not upgrade your system pip and instead use a virtualenv.
To recover the pip3 binary you'll need to sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall.
It should work fine if you use the first approach python3 -m pip ... instead of pip3 ....
Trying to install eyed3 but it's giving me this error:
>>> import eyed3
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import eyed3
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\eyed3\__init__.py", line 35, in <module>
from .utils.log import log # noqa
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\eyed3\utils\__init__.py", line 27, in <module>
import magic
File "C:\Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\site-packages\magic.py", line 176, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
Here's the pip install:
I tried to uninstall with pip and delete all the eyed3 files, then re-install and it still gave the same error. It also does the same thing with easy_install.
On Windows
You'll need DLLs for libmagic. #julian-r has uploaded a version of this project that includes binaries to pypi: https://pypi.python.org/pypi/python-magic-bin/0.4.14
pip install python-magic-bin==0.4.14
Works for me.
I fixed it by installing libmagic with this command
brew install libmagic
You need to install libmagic before you install eye3d.
Here is a link to the git.
https://github.com/ahupp/python-magic#dependencies
You can use this to install it:
pip install python-magic
I'm not sure why pip always throw the exception that 'can not find pyparsing'.
even When I try to download pyparsing i get:
pip install pyparsing
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 9, in <module>
from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
ImportError: No module named pyparsing
It doesn't make sense?!
Even after I did what Shahin and Paul said, I still get the same error. So I removed pip and reinstall it:
sudo apt-get purge python-pip
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
Try Downloading the wheel file and install
wget https://pypi.python.org/packages/6a/8a/718fd7d3458f9fab8e67186b00abdd345b639976bc7fb3ae722e1b026a50/pyparsing-2.2.0-py2.py3-none-any.whl#md5=7247e7896688eff4bc8c7fc5d0cdd2b0
pip install pyparsing-2.2.0-py2.py3-none-any.whl
In case you face any issue with wget command download , you can get the wheel file from the following link
https://pypi.python.org/pypi/pyparsing/2.2.0#downloads
I am trying to install the elastic beanstalk CLI on an EC2 instance (running AMI) using these instructions:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-getting-started.html
I have python 2.7.9 installed, pip and eb. However, when I try to run eb I get the error below. It looks like it is still using python 2.6. How do you fix that?
Thanks!
Traceback (most recent call last):
File "/usr/bin/eb", line 9, in <module>
load_entry_point('awsebcli==3.0.10', 'console_scripts', 'eb')()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2568, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2259, in load
['__name__'])
File "/usr/lib/python2.6/site-packages/ebcli/core/ebcore.py", line 23, in <module>
from ..controllers.initialize import InitController
File "/usr/lib/python2.6/site-packages/ebcli/controllers/initialize.py", line 16, in <module>
from ..core.abstractcontroller import AbstractBaseController
File "/usr/lib/python2.6/site-packages/ebcli/core/abstractcontroller.py", line 21, in <module>
from ..core import io, fileoperations, operations
File "/usr/lib/python2.6/site-packages/ebcli/core/operations.py", line 762
vars = {n['OptionName']: n['Value'] for n in settings
^
SyntaxError: invalid syntax
Pip is probably set up with Python 2.6 instead of python 2.7.
pip --version
You can reinstall pip with Python 2.7, then reinstall 2.6
pip uninstall awsebcli
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install awsebcli
I had the same problem, the fix for me was actually to upgrade to latest Beanstalk stack ( eb upgrade ). Note there are downtime etc. So investigate if you can run the latest stack before upgrading.
The "smartest" solution for me was to install python-dev tools
sudo apt install python-dev
found here:
http://ericbenson.azurewebsites.net/deployment-on-aws-elastic-beanstalk-for-ubuntu/
Followed instructions on the github page. Of course, had to make minor changes since I was working with a windows 7 system. I got to the point post creating the virtual environment for portia to run. And I was trying to install the required packages using pip.
pip install -r requirements.txt
It failed with a log.
Now in the shell I try to run twistd, it gives error saying command not found. I even tried as follows:
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$ python ../../portia_env/Scripts/twistd.py -n slyd
Traceback (most recent call last):
File "../../portia_env/Scripts/twistd.py", line 13, in <module>
from twisted.scripts.twistd import run
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 53, in
<module>
_checkRequirements()
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 37, in
_checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zop
e.interface.
(portia_env)
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$
Is there an alternate procedure to follow in order to make this work on windows?
It looks like zope.interface didn't install when you ran:
pip install -r requirements.txt
Could you try running the following and see if it works?
pip install zope.interface