Error running either python3 setup.py install "TypeError: must be str, not NoneType"
See original GitHub issueI just installed an API pyunicorn and when I import it I get an error. It tells me that it cannot import setup. Therefore, I went to install setup.py. My steps were: First:
cd /home/user/python-3.7.2/
Second:
python3 setup.py install
or
pip3 install .
It gives the following error:
Obtaining file:///home/user/Python-3.7.2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/marlon/Python-3.7.2/setup.py", line 30, in <module>
set_compiler_flags('LDFLAGS', 'PY_LDFLAGS_NODIST')
File "/home/marlon/Python-3.7.2/setup.py", line 27, in set_compiler_flags
sysconfig.get_config_vars()[compiler_flags] = flags + ' ' + py_flags_nodist
TypeError: must be str, not NoneType
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/user/Python-3.7.2/
How to solve it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
TypeError: must be str, not NoneType - python - Stack Overflow
To prevent the error, a possible solution would be to add a conditional OR a try/except expression to your code. I'll demo a...
Read more >Changelog — Python 3.11.1 documentation
gh-94526: Fix the Python path configuration used to initialized sys.path at Python startup. Paths are no longer encoded to UTF-8/strict to avoid encoding...
Read more >Understanding Python errors — Using Python for Science
Because Python does not do type checking ahead of running the code, it's common for programs ... line 1, in <module> TypeError: must...
Read more >Common issues and solutions - mypy 0.991 documentation
If installation fails, you've probably hit one of these issues: Mypy needs Python 3.6 or later to run. You may have to run...
Read more >OpenCV: Resolving NoneType errors - PyImageSearch
The cv2.imread function does not explicitly throw an error message if you give it an invalid file path (i.e., a path to a...
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 FreeTop 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
Top GitHub Comments
You’re welcome. We humans make mistakes all the time (I’d argue that it is one of the things that makes us humans 😄), so don’t let others’ mistake let you down, take it as opportunity to learn from (e.g. about Python packaging in this case 😉). In your very case you might want to install an older version (0.6.0.post1) until it gets fixed.
Hey I just fixed it. I have to thank you very much.
The source of error was: “[T]he line in question is referring to version from the setup.py file […] doesn’t exist in the site-packages package.” from here.
Solution:
I’ve copied the script in
setup.py
and remove the line containingfrom setup import __version__
by creating a new file__init__py
. Then I’ve removed the old one and replace by the one I’ve created. And it worked! 😄Happy!