ImportError: cannot import name __version__
See original GitHub issueTried to install this packaged via
pip3 install pipreqs
which succeeded without error. However, I am unable to run it from the command line or import the library via the Python interpreter. In both cases I get the traceback below:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipreqs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/users/me/.local/lib/python3.5/site-packages/pipreqs/pipreqs.py", line 37, in <module>
from pipreqs import __version__
ImportError: cannot import name '__version__'
Environment info
- Python 3.5.3
Output of uname -a
Linux ace-ws-15 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
Python ImportError: cannot import name __version__ ...
ImportError : cannot import name __version__ Try to modify the init.py in the root of the openpyxl paceage folder, don't read the version...
Read more >How to Fix ImportError: Cannot Import Name in Python - Rollbar
The imported class is in a circular dependency. · The imported class is unavailable or was not created. · The imported class name...
Read more >ImportError: cannot import name version · Issue #596 - GitHub
I try to install a module named "seq2seq" which use smart_open but when I try to run it I have this errror message...
Read more >How to Fix : “ImportError: Cannot import name X” in Python
In Python "ImportError: cannot import name" error generally occurs when the imported class is not accessible, or the imported class is in a...
Read more >ImportError: cannot import name X in Python [Solved]
The Python "ImportError: cannot import name" often occurs when we have circular imports (importing members between the same files).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Although the question is a little bit old, I still consider relevant since I’ve faced the exactly same problem and the solution I found was to downgrade the “pipreqs” module to 0.4.8.
Btw… my scenario is different than presented here… The python version is 2.7.18 and according to the “History” session within “pipreqs” website (https://pypi.org/project/pipreqs) I’ve decided to teste version 0.4.8 based on the release date.
I ran into the same issue because I was running the pipreqs.py file from site-packages to avoid adding it to path on windows. I called the file directly and it could not find version.
A fix for this is to edit the init.py file in the site-packages and copy all of the code defining author, email, and version
and paste it into the pipreqs.py file in place of
On line 50. (Removing that import statement and defining the version in the file itself)