ecmwf-lab / ai-models

Apache License 2.0
365 stars 55 forks source link

pip install fails with latest version (0.5.1) #41

Closed mrydz closed 5 months ago

mrydz commented 5 months ago

pip install ai-models is failing with the latest release (0.5.1), on fresh install.

Environment:

models@psf3sp336f92:~$ python -V
Python 3.10.14
models@psf3sp336f92:~$ pip -V
pip 24.0 from [redacted]/python3.10/site-packages/pip (python 3.10)
models@psf3sp336f92:~$ pip list
Package    Version
---------- -------
pip        24.0
setuptools 69.5.1
wheel      0.43.0

Error:

Building wheel for ai-models (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [76 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/ai_models
      copying ai_models/checkpoint.py -> build/lib/ai_models
      copying ai_models/__init__.py -> build/lib/ai_models
      copying ai_models/model.py -> build/lib/ai_models
      copying ai_models/__main__.py -> build/lib/ai_models
      copying ai_models/stepper.py -> build/lib/ai_models
      creating build/lib/ai_models/outputs
      copying ai_models/outputs/__init__.py -> build/lib/ai_models/outputs
      creating build/lib/ai_models/inputs
      copying ai_models/inputs/__init__.py -> build/lib/ai_models/inputs
      creating build/lib/ai_models/remote
      copying ai_models/remote/config.py -> build/lib/ai_models/remote
      copying ai_models/remote/api.py -> build/lib/ai_models/remote
      copying ai_models/remote/__init__.py -> build/lib/ai_models/remote
      copying ai_models/remote/model.py -> build/lib/ai_models/remote
      running egg_info
      writing ai_models.egg-info/PKG-INFO
      writing dependency_links to ai_models.egg-info/dependency_links.txt
      writing entry points to ai_models.egg-info/entry_points.txt
      writing requirements to ai_models.egg-info/requires.txt
      writing top-level names to ai_models.egg-info/top_level.txt
      reading manifest file 'ai_models.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file 'ai_models.egg-info/SOURCES.txt'
      /home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!

              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.

              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************

      !!
        self.initialize_options()
      installing to build/bdist.linux-x86_64/wheel
      running install
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-ukow8kqu/ai-models_3edcd1c77e1d4c3593e46213141cac9d/setup.py", line 43, in <module>
          setuptools.setup(
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 403, in run
          self.run_command("install")
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/home/models/micromamba/envs/[redacted]/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-ukow8kqu/ai-models_3edcd1c77e1d4c3593e46213141cac9d/setup.py", line 35, in run
          from ai_models.remote.config import config_exists, create_config
        File "/tmp/pip-install-ukow8kqu/ai-models_3edcd1c77e1d4c3593e46213141cac9d/ai_models/remote/__init__.py", line 1, in <module>
          from .api import RemoteAPI
        File "/tmp/pip-install-ukow8kqu/ai-models_3edcd1c77e1d4c3593e46213141cac9d/ai_models/remote/api.py", line 7, in <module>
          import requests
      ModuleNotFoundError: No module named 'requests'

The issue appears to be the new ai_models remote api. setuptools had

cmdclass={
        "install": PostInstall,
    },

added, but when that is run, requests, multiurl, and climetlab have not been fully installed causing the install to fail with the above error.

Two current workarounds:

  1. pip install requests multiurl climetlab then pip install ai-models
  2. pip install ai-models==0.4.3 then pip install ai-models --upgrade
jacob-t-radford commented 5 months ago

Can confirm I had the same issue and also used workaround #1

gmertes commented 5 months ago

Thanks for the report! This didn't work as expected so I removed it.

Fixed in 0.5.3