Skip to content

Installation error: ModuleNotFoundError: No module named 'pydantic' #178

@aloboa

Description

@aloboa

I'm trying to install on a linux machine (ubuntu 22.04.5, GPU NVIDIA RTX A4000). I do the following with no problems:

$ conda create -n dtree2 python==3.10
$ conda activate dtree2
$ cd dtree2
$ gdal-config --version 
$ conda install gdal pygeos geopandas numpy opencv -c conda-forge
$ pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

But then the last step:

$ pip install git+https://github.com/PatBall1/detectree2.git
Collecting git+https://github.com/PatBall1/detectree2.git
  Cloning https://github.com/PatBall1/detectree2.git to /tmp/pip-req-build-konsnq7s
  Running command git clone --filter=blob:none --quiet https://github.com/PatBall1/detectree2.git /tmp/pip-req-build-konsnq7s
  Resolved https://github.com/PatBall1/detectree2.git to commit 61eb66c27684ccd8b747ac6ac047801390c23cbc
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      /home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/_distutils/dist.py:270: UserWarning: Unknown distribution option: 'test_suite'
        warnings.warn(msg)
      Traceback (most recent call last):
        File "/home/alobo2/.local/lib/python3.10/site-packages/npe2/_pydantic_compat.py", line 3, in <module>
          from pydantic.v1 import (
      ModuleNotFoundError: No module named 'pydantic'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-konsnq7s/setup.py", line 3, in <module>
          setup(
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
          _setup_distribution = dist = klass(attrs)
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/dist.py", line 319, in __init__
          _Distribution.__init__(self, dist_attrs)
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 290, in __init__
          self.finalize_options()
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/dist.py", line 680, in finalize_options
          for ep in sorted(loaded, key=by_order):
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/site-packages/setuptools/dist.py", line 679, in <lambda>
          loaded = map(lambda e: e.load(), filtered)
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/importlib/metadata/__init__.py", line 162, in load
          module = import_module(match.group('module'))
        File "/home/alobo2/miniforge3/envs/dtree2/lib/python3.10/importlib/__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 883, in exec_module
        File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
        File "/home/alobo2/.local/lib/python3.10/site-packages/npe2/__init__.py", line 11, in <module>
          from ._dynamic_plugin import DynamicPlugin
        File "/home/alobo2/.local/lib/python3.10/site-packages/npe2/_dynamic_plugin.py", line 17, in <module>
          from npe2._pydantic_compat import BaseModel, ValidationError
        File "/home/alobo2/.local/lib/python3.10/site-packages/npe2/_pydantic_compat.py", line 21, in <module>
          from pydantic import (
      ModuleNotFoundError: No module named 'pydantic'
      [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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions