Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValueError: source code string cannot contain null bytes

I'm originally an Ubuntu user, but I have to use a Windows Virtual Machine for some reason.

I was trying to pip-install a package using the CMD, however, I'm getting the following error:

from pip._vendor.packaging.utils import canonicalize_name
   ValueError: source code string cannot contain null bytes

I used pip install numpy and pip3 install numpy along with other commands I found while tying to fix the problem.

I checked that pip is available and reinstalled Python to make sure the path is added. I've also made sure that I'm running everything as an administrator. Everything seems to be installed properly, but I keep getting that error.

I've also checked almost all other StackOverflow questions related to this error message.

How can I solve this?

like image 934
Esraa Abdelmaksoud Avatar asked Jun 09 '26 00:06

Esraa Abdelmaksoud


1 Answers

The error that occurred was while using "Python 3.10.11 (64-bit)". Though I reinstalled it the issue continued.

When I downgraded to "Python 3.9.0 (64-bit)", the issue was solved.

like image 88
Esraa Abdelmaksoud Avatar answered Jun 11 '26 12:06

Esraa Abdelmaksoud