-3

So I am trying to use pip install bitarray but that results in a error, even I can't really understand. I have had this issue a while already with few other packages, today I installed a virtual environment and I tried to code again. I tried to install the package outside of this venv but I get the same error.

Collecting bitarray
Using cached bitarray-2.1.0.tar.gz (71 kB)
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Installing collected packages: bitarray
    Running setup.py install for bitarray ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\workspace\work_env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\desup\\Acal\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"'; __file__='"'"'C:\\Users\\desup\\AppData\\Local\\Temp\ll-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__se io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(cod_, '"'"'exec'"'"'))' install --record 'C:\Users\desup\AppData\Local\Temp\pip-record-c9vvo7_u\install-record.txt' --single-version-externally-manpile --install-headers 'd:\workspace\work_env\include\site\python3.9\bitarray'
         cwd: C:\Users\desup\AppData\Local\Temp\pip-install-zbskwcko\bitarray_19f857dc240346679ec2269bbe2d36b2\
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_util.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\__init__.py -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\bitarray.h -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\pythoncapi_compat.h -> build\lib.win-amd64-3.9\bitarray
    copying bitarray\test_data.pickle -> build\lib.win-amd64-3.9\bitarray
    running build_ext
    building 'bitarray._bitarray' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\workspace\work_env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\desup\\AppData\\Local\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"'; __file__='"'"'C:\\Users\\desup\\AppData\\Local\\Temp\\pip-install-zbskwcko\\bitarray_19f857dc240346679ec2269bbe2d36b2\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\desup\AppData\Local\Temp\pip-record-c9vvo7_u\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\workspace\work_env\include\site\python3.9\bitarray' Check the logs for full command output.```
dnnsqe
  • 25
  • 1
  • 5

1 Answers1

1

This part

Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

suggest that you should install Microsoft Visual C++ 14.0 before installing bitarray. bitarray's PyPI page hints that you need working C compiler before installing bitarray.

Daweo
  • 31,313
  • 3
  • 12
  • 25
  • Thanks! The error message is gone by now, but I am still getting a notification under "Problems" `Import "bitarray" could not be resolved Pylance(reportMissingImports) [2, 8]` Update: I had to change the python interpreter from the venv to the python.exe, this way it works! – dnnsqe Jun 07 '21 at 12:39