Why can't I install packages in my PyCharm?I remember that i can install some packages a couple of days ago...
Detail:
The error output of the command:
Traceback (most recent call last):
File "E:\PyCharm 3.4.1\helpers\packaging_tool.py", line 125, in main
retcode = do_install(pkgs)
File "E:\PyCharm 3.4.1\helpers\packaging_tool.py", line 56, in do_install
import pip
File "E:\python\lib\site-packages\pip\__init__.py", line 4, in <module>
import logging
File "E:\python\lib\logging\__init__.py", line 26, in <module>
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
File "E:\python\lib\collections\__init__.py", line 50
self, *args = args
^
SyntaxError: invalid syntax
This is likely because you're using a very old version of PyCharm that was buggy. You're currently using 3.4.1 (as shown in your error log), when you should actually be using 4.5.3.
Related
I'm using terminal on mac, and anytime I attempt to use pip, I get the following error message telling me that it cannot find a module named zlib:
$ pip --version
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 42, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
I've read several SO posts with the same error message, and have tried their solutions, including attempting to install zlib using homebrew, which fails, and updating my Xcode developer tools. I also installed pip earlier using python get-pip.py, and it said it installed successfully.
The reason I need pip is to install a package for use on python 2.7, but doing $ pip install "package-name" produces the same error as above. I have both Python 2 and 3 installed on my machine, if that helps. I'm kind of new to pip and using the command line in general, and I'm super confused; if anyone could help me out I'd really appreciate it.
This is the OP. I was able to fix the issue, and wanted to post my solution here in case it would help others.
Essentially I believe it occurred because Python2 is default on my machine, but pip is by default pointing to resources pertaining to Python3, or something like that. Doing pip2 --version instead provided the expected response.
I am using Windows 10.
I just tried in my Anaconda prompt: pip install email
I got the following error:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.6.egg\setuptools\__init__.py", line 10, in <module>
File "C:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.6.egg\setuptools\extern\__init__.py", line 1, in <module>
File "C:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 35, in <module>
File "C:\Users\DIMITR~1.LIA\AppData\Local\Temp\pip-build-1vvnmrhi\email\email\parser.py", line 10, in <module>
from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'
Looks like there is no need to install email via pip. Just import it in your Python code.
The error is saying that you do not have the package cStringIO.
To resolve this use following:
pip install cStringIO
if this does not help, try:
pip install StringIO
Here is more documentation about the packages StringIO and cStringIO https://docs.python.org/2/library/stringio.html
I am trying to install hashlib on my mac. pip doesn't work, and easy_install also does not work.
Here is the error:
Collecting hashlib
Using cached hashlib-20081119.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 36, in <module>
import email.parser
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/feedparser.py", line 27, in <module>
from email import message
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 16, in <module>
from email import utils
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/utils.py", line 28, in <module>
import random
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/random.py", line 45, in <module>
from hashlib import sha512 as _sha512
File "/private/var/folders/nw/flrm4y0d499fk5xr2ppxk4sr0000gn/T/pip-build-lv720o4k/hashlib/hashlib.py", line 80
raise ValueError, "unsupported hash type"
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/nw/flrm4y0d499fk5xr2ppxk4sr0000gn/T/pip-build-lv720o4k/hashlib/
Any further suggestions would be great. Thanks in advance!
I know this question is very old, but I stumbled upon it on Google because I had the same problem just now. In my case, I was working with an AWS Elastic Beanstalk, and my environment got that exact same cryptic error message about a syntax error inside hashlib.
For AWS, the trick is NOT including all your imports in the requirements.txt file, but only things you would normally have to pip install. That includes modules like hashlib, string, and random.
So for others who stumble upon this question: there is no need to install hashlib, just import it and you're ready to go!
sudo apt-get install libffi-dev g++ libssl-dev
via https://github.com/bigchaindb/bigchaindb/issues/24#issuecomment-183370814
I have found several pip problems on stack overflow, but unfortunately it seems like I am experiencing some that I can't find.
Particularly I am getting following error message whenever I try to use pip:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 9, in <module>
load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
File "build/bdist.macosx-10.5-intel/egg/pkg_resources.py", line 357, in load_entry_point
"""Yield named metadata resource as list of non-blank non-comment lines
File "build/bdist.macosx-10.5-intel/egg/pkg_resources.py", line 2394, in load_entry_point
except ValueError:
File "build/bdist.macosx-10.5-intel/egg/pkg_resources.py", line 2108, in load
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/__init__.py", line 10, in <module>
from pip.backwardcompat import u, walk_packages, console_to_str
ImportError: cannot import name walk_packages
Does anyone have any idea what can be wrong?
Until now I have tried to reinstall pip as it was recommended here: Python mechanize module not found and I have also tried this Pip using system python osx, but non of them works for me.
Thank you in advance for any advices.
Somehow solved by command sudo easy_install -U pip
Getting this error when running pip install -U selenium. Mid way through the script, it gets the following SyntaxError:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "C:\Python32\Scripts\build\rdflib\setup.py", line 6, in <module>
from rdflib import __version__
File "rdflib\__init__.py", line 64, in <module>
from rdflib.term import URIRef, BNode, Literal, Variable
File "rdflib\term.py", line 367
except TypeError, te:
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Since it is a Syntax Error, I assume it is a python version problem, I'm running 3.2.2.
Pip did come with a pip-3.2.exe file, which I tried to run. But I got the same error. I'm pretty new to Python so it might be something simple.
And how can it be a syntaxError? pip is an already made program.
Running Win7, Python 3.2.2
Selenium does not support Python 3. Use Python 2.7 instead.
Sadly, almost all Python software requires Python 2.x.
[Update]
Selenium supports Python 3.x now.