question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error running either python3 setup.py install "TypeError: must be str, not NoneType"

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
McSinyxcommented, Jul 27, 2020

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.

0reactions
marlon-shiftonecommented, Jul 27, 2020

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 containing from 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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found