pip can't find a package even though it's installed

servoz's Avatar

servoz

04 Jul, 2023 09:12 AM

When a dependency (dipy) is installed with pip on an appveyor windows build, the installation fails because a module is not installed (packaging).

However, it is installed (in C:\Python37\lib\site-packages).

In fact, when we look at the traceback, we'll notice that at first it's C:\Python37\lib\site-packages that's used, then when we search for the hook, we switch to C:\Users\appveyor\AppData\Local\Temp\1\pip-build-env-en87c6ej\overlay\Lib\site-packages (vide infra), where I think packaging isn't installed.

I don't understand why this is happening and how to fix it.

Collecting dipy (from mia-processes>=2.3.0->populse-mia==2.4.1.dev0+8df8ccf7)
  Downloading dipy-1.7.0.tar.gz (12.4 MB)
     --------------------------------------- 12.4/12.4 MB 29.7 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error
  
  Getting requirements to build wheel did not run successfully.
  exit code: 1
  
  [19 lines of output]
  Traceback (most recent call last):
    File "C:\Python37\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\Python37\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Python37\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "C:\Users\appveyor\AppData\Local\Temp\1\pip-build-env-en87c6ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "C:\Users\appveyor\AppData\Local\Temp\1\pip-build-env-en87c6ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
      self.run_setup()
    File "C:\Users\appveyor\AppData\Local\Temp\1\pip-build-env-en87c6ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 488, in run_setup
      self).run_setup(setup_script=setup_script)
    File "C:\Users\appveyor\AppData\Local\Temp\1\pip-build-env-en87c6ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 35, in <module>
    File "C:\Users\appveyor\AppData\Local\Temp\1\pip-install-1nml3j3e\dipy_a5069f489a1242509a5cd4120d68f564\cythexts.py", line 7, in <module>
      from packaging.version import Version
  ModuleNotFoundError: No module named 'packaging'
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel 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.
  1. servoz closed this discussion on 07 Jun, 2024 10:45 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac