Sanjiv Pradhanang
Sanjiv Pradhanang

Reputation: 87

ImportError: cannot import name 'msvccompiler' from 'distutils'

I am trying to install the neuralcoref and allennlp library using pip in my virtual environment with Python 3.12.3. I am using visual studio code as my editor. Some sort of dependency error always turns up. The one below in particular. At this point any handy code for performing coreference resolution will do rather than fixing this error itself as well.

error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Collecting setuptools
        Using cached setuptools-75.3.0-py3-none-any.whl.metadata (6.9 kB)
      Collecting wheel<0.33.0,>0.32.0
        Using cached wheel-0.32.3-py2.py3-none-any.whl.metadata (2.1 kB)
      Collecting Cython
        Using cached Cython-3.0.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
      Collecting cymem<2.1.0,>=2.0.2
        Using cached cymem-2.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.4 kB)
      Collecting preshed<2.1.0,>=2.0.1
        Using cached preshed-2.0.1.tar.gz (113 kB)
        Preparing metadata (setup.py): started
        Preparing metadata (setup.py): finished with status 'error'
        error: subprocess-exited-with-error
      
        × python setup.py egg_info did not run successfully.
        │ exit code: 1
        ╰─> [6 lines of output]
            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 34, in <module>
              File "/tmp/pip-install-p0_beefn/preshed_85a75e93cab645b097eb3e93e834b6d5/setup.py", line 9, in <module>
                from distutils import ccompiler, msvccompiler
            ImportError: cannot import name 'msvccompiler' from 'distutils' (/home/sanjiv/Documents/git_stuff/LeuphanaStuff/MasterThesis/.venv3.12/lib/python3.12/site-packages/setuptools/_distutils/__init__.py). Did you mean: 'ccompiler'?
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed
      
      × Encountered error while generating package metadata.
      ╰─> See above for output.
      
      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Upvotes: 0

Views: 1886

Answers (0)

Related Questions