Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbi cannot be installed in python version 3.7 #888

Closed
michaeldeistler opened this issue Nov 3, 2023 · 5 comments
Closed

sbi cannot be installed in python version 3.7 #888

michaeldeistler opened this issue Nov 3, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@michaeldeistler
Copy link
Contributor

Installing sbi (from source) fails in python version 3.7. It works in version 3.6, 3.8, and 3.9 (and probably also 3.10 and higher, but I did not check).

This also leads to failing tests.

@michaeldeistler
Copy link
Contributor Author

Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/deismic/anaconda3/envs/sbi_test_36/bin/python /Users/deismic/anaconda3/envs/sbi_test_36/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/tmp9rb7qkio
       cwd: /private/var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/pip-install-tyzx6lgk/netcdf4_0ce9b5aaec844fccab9aa9f82e9c6072
  Complete output (39 lines):
  reading from setup.cfg...
  
      HDF5_DIR environment variable not set, checking some standard locations ..
  checking /Users/deismic/anaconda3/envs/sbi_test_36/include ...
  hdf5 headers not found in /Users/deismic/anaconda3/envs/sbi_test_36/include
  checking /Users/deismic/anaconda3/envs/sbi_test_36/Library/include ...
  hdf5 headers not found in /Users/deismic/anaconda3/envs/sbi_test_36/Library/include
  checking /Users/deismic/include ...
  hdf5 headers not found in /Users/deismic/include
  checking /usr/local/include ...
  hdf5 headers not found in /usr/local/include
  checking /sw/include ...
  hdf5 headers not found in /sw/include
  checking /opt/include ...
  hdf5 headers not found in /opt/include
  checking /opt/local/include ...
  hdf5 headers not found in /opt/local/include
  checking /opt/homebrew/include ...
  hdf5 headers not found in /opt/homebrew/include
  checking /usr/include ...
  hdf5 headers not found in /usr/include
  Traceback (most recent call last):
    File "/Users/deismic/anaconda3/envs/sbi_test_36/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
      main()
    File "/Users/deismic/anaconda3/envs/sbi_test_36/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/deismic/anaconda3/envs/sbi_test_36/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 117, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/pip-build-env-ss2qqkey/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 163, in get_requires_for_build_wheel
      config_settings, requirements=['wheel'])
    File "/private/var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/pip-build-env-ss2qqkey/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/pip-build-env-ss2qqkey/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 449, in <module>
      _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
    File "setup.py", line 390, in _populate_hdf5_info
      raise ValueError('did not find HDF5 headers')
  ValueError: did not find HDF5 headers
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/a6/f9/12f43c2e31d1c7aae0827820ae747fa4c7cc382b38dab11e8c11575d3af6/netCDF4-1.6.2.tar.gz#sha256=0382b02ff6a288419f6ffec85dec40f451f41b8755547154c575ddd9f0f4ae53 (from https://pypi.org/simple/netcdf4/) (requires-python:>=3.6). Command errored out with exit status 1: /Users/deismic/anaconda3/envs/sbi_test_36/bin/python /Users/deismic/anaconda3/envs/sbi_test_36/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/j9/w7ftvg_16t1f9bgp1cy4bt1r0000gn/T/tmp9rb7qkio Check the logs for full command output.```

@bnicenboim
Copy link

Hi, I solved that problem by installing libnetcdf-dev in linux

@etouron1
Copy link

etouron1 commented Feb 7, 2024

Hello, I had a similar error due with Python 3.7 when installing sbi.
I work on Ubuntu 22.04.3 LTS.
I tried to install sbi in a new conda environment following the section Installation from the README of the sbi github.
When doing pip install sbi in this environment, I get the following error :

(...)

Collecting netcdf4
  Using cached netCDF4-1.6.5.tar.gz (764 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      reading from setup.cfg...
      
          HDF5_DIR environment variable not set, checking some standard locations ..
      checking /home/sbi/miniconda3/envs/try_env/include ...
      hdf5 headers not found in /home/sbi/miniconda3/envs/try_env/include
      checking /home/sbi/miniconda3/envs/try_env/Library/include ...
      hdf5 headers not found in /home/sbi/miniconda3/envs/try_env/Library/include
      checking /home/sbi/include ...
      hdf5 headers not found in /home/sbi/include
      checking /usr/local/include ...
      hdf5 headers not found in /usr/local/include
      checking /sw/include ...
      hdf5 headers not found in /sw/include
      checking /opt/include ...
      hdf5 headers not found in /opt/include
      checking /opt/local/include ...
      hdf5 headers not found in /opt/local/include
      checking /opt/homebrew/include ...
      hdf5 headers not found in /opt/homebrew/include
      checking /usr/include ...
      hdf5 headers not found in /usr/include
      Traceback (most recent call last):
        File "/home/sbi/miniconda3/envs/try_env/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/home/sbi/miniconda3/envs/try_env/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/sbi/miniconda3/envs/try_env/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-o3frre5j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-o3frre5j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-o3frre5j/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 457, in <module>
        File "<string>", line 398, in _populate_hdf5_info
      ValueError: did not find HDF5 headers
      [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.

To solve it, I install the package netcdf4 via the command conda install -c conda-forge netCDF4 and then re-do pip install sbi.
It works.

I don't know where the error comes from but trying to install sbi with a higher version of Python (>3.7) does not throw any error.

@michaeldeistler
Copy link
Contributor Author

Related to #928

@janfb janfb added this to the Pre Hackathon 2024 milestone Feb 9, 2024
@janfb janfb self-assigned this Feb 9, 2024
@michaeldeistler michaeldeistler added the bug Something isn't working label Feb 9, 2024
@janfb
Copy link
Contributor

janfb commented Feb 16, 2024

I can confirm @etouron1's fix: On Ubuntu 20.04.2 the following works:

conda create -n sbi_env python==3.7
conda activate sbi_env
conda install -c conda-forge netCDF4
pip install sbi

Installing sbi with python 3.6 or 3.8, 3.9, 3.10, 3.11 works fine.

@janfb janfb closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants