2

I am trying to install the package using pip3, for example, the following command:

sudo pip3 install testresources setuptools==49.6.0 

But, get the following error:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ValueError: source code string cannot contain null bytes

What I have tried:

Remove pip3 by purge and install it again by sudo apt-get install python3-pip

If it helps, the python version is 3.6.9.

OmG
  • 18,337
  • 10
  • 57
  • 90
  • Possible duplicate of: https://stackoverflow.com/questions/31233777/python-source-code-string-cannot-contain-null-bytes – TheBotlyNoob Apr 25 '21 at 01:12
  • 3
    @TheBotlyNoob Definitely it is not duplicate! The post that you have mentioned is about a graphic library in MacOS, but mine is about the installation of any package with pip3 in ubuntu! – OmG Apr 25 '21 at 01:14
  • Does this still occur if you do a single-user installation? `pip3 install --user testresources setuptools==49.6.0` – Jack Taylor Apr 25 '21 at 01:25
  • it seems the `pip3` is corrupted. It is not clear if it's the shortcut `/usr/bin/pip3` or the pip module itself. Can you try running `sudo python3 -m pip install `? – Marat Apr 25 '21 at 02:23
  • @Marat this command gets the same error! – OmG Apr 25 '21 at 14:48
  • If you are using system python, try reinstalling pip. If you have a functional `easy_install`, `easy_install pip3` (sudo if pip is installed systemwide). If you don't have easy_install, and using system pip, `sudo apt-get install --reinstall python3-pip`. If pip was installed in a user folder, remove local pip and [re]install the system one. – Marat Apr 25 '21 at 18:09

0 Answers0