First time here? Checkout the FAQ!
x
0 votes
by (460 points)

Hi all,

When I tried to install the latest version of carputils on macOS(12.4), while running python3 -m pip install . --user, the following error occurred:

Preparing metadata (setup.py) ... error

  error: subprocess-exited-with-error

  

  × python setup.py egg_info did not run successfully.

  exit code: 1

  ╰─> [31 lines of output]

      /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.

        warnings.warn(

      WARNING: The wheel package is not available.

      Traceback (most recent call last):

        File "<string>", line 2, in <module>

        File "<pip-setuptools-caller>", line 34, in <module>

        File "/Users/abc/openCARP/external/carputils/setup.py", line 131, in <module>

          setup(name='carputils',

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 86, in setup

          _install_setup_requires(attrs)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires

          dist.fetch_build_eggs(dist.setup_requires)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/dist.py", line 876, in fetch_build_eggs

          resolved_dists = pkg_resources.working_set.resolve(

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 789, in resolve

          dist = best[req.key] = env.best_match(

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1075, in best_match

          return self.obtain(req, installer)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1087, in obtain

          return installer(requirement)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/dist.py", line 956, in fetch_build_egg

          return fetch_build_egg(self, req)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/installer.py", line 87, in fetch_build_egg

          wheel.install_as_egg(dist_location)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/wheel.py", line 96, in install_as_egg

          self._install_as_egg(destination_eggdir, zf)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/wheel.py", line 104, in _install_as_egg

          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)

        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/wheel.py", line 148, in _convert_metadata

          os.rename(dist_info, egg_info)

      OSError: [Errno 66] Directory not empty: '/Users/abc/openCARP/external/carputils/.eggs/numpy-1.22.4-py3.9-macosx-10.9-universal2.egg/numpy-1.22.4.dist-info' -> '/Users/abc/openCARP/external/carputils/.eggs/numpy-1.22.4-py3.9-macosx-10.9-universal2.egg/EGG-INFO'

      [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.

Thank you!

2 Answers

0 votes
by (3.4k points)

Did you try to upgrade your pip and setuptools versions?

python3 -m pip install --upgrade pip 

python3 -m pip install --upgrade setuptools

by (460 points)
Yes, I did, they are already requirements satisfied.  But the error is still existing.
by (460 points)
I tried to completely remove the carputils folder and reinstall it, I have now gotten pass this error, but then another error occurred:
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
  ╰─> [12 lines of output]
      /var/folders/f0/fbtgv9bx5n3g_lg7_9brv0hh0000gn/T/H5closed0b9j2f9.c:2:5: error: implicit declaration of function 'H5close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          H5close();
          ^
      1 error generated.
      cpuinfo failed, assuming no CPU features: No module named 'cpuinfo'
      * Using Python 3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23)
      * Found cython 0.29.30
      * USE_PKGCONFIG: True
      .. ERROR:: Could not find a local HDF5 installation.
         You may need to explicitly state where your local HDF5 headers and
         library can be found by setting the ``HDF5_DIR`` environment
         variable or by using the ``--hdf5`` command-line option.
      [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.
by (3.4k points)
This is due to the fact that no wheel is existing yet for the Python package tables on arm64 Macs.
You have to install HDF5 on your system before being able to install tables.
See this issue for more information: https://opencarp.org/q2a/637/during-carputils-installation-installing-python-dependency
by (460 points)
Thank you so much! It works, I have been able to install it. However, while I try to run some examples (https://opencarp.org/documentation/examples/02_ep_tissue/01_basic_usage), it did not recognize that I have already installed carputils.

The command is:
python3 run.py --duration 20 --S1-strength 20. --S1-dur 15 --visualize

The error message is:
Traceback (most recent call last):
  File "/Users/abc/openCARP/external/experiments/tutorials/02_EP_tissue/01_basic_usage/run.py", line 155, in <module>
    from carputils import settings
ModuleNotFoundError: No module named 'carputils'

I have already modified the path in "settings.yaml" to:
CARP_EXE_DIR:
    CPU: /Users/abc/openCARP/_build/bin
# Other paths
MESHALYZER_DIR: /Users/abc/meshalyzer
# Path to the directory containing the openCARP source files
OPENCARP_SRC:   /Users/abc/openCARP/

The location where I installed the carputils is:
/Users/abc/openCARP/external/carputils/
by (3.4k points)
If the installation of carputils with the following command run from the carputils directory

python3 -m pip install .

was successful, this is most likely an issue linked to your Python setup.

Are you sure that the Python executable you used for installing carputils is the same as the one used for running the example?

You can test if carputils is correctly installed by running

python3 -c "import carputils; print(carputils)"

If it prints the installation location, your carputils is successfully installed.

Alternatively, you can install caprutils following the installation instructions for developers:
https://opencarp.org/download/installation#development-installation
In this case, it is important to add carputils to your PATH and PYTHONPATH as explained in the instructions.
0 votes
by (1.3k points)
Personally, I have found that the most foolproof way to install carputils is through the developer instructions, as Marie suggested. Her suggestion on adding carputils to the PATH and PYTHONPATH variables is especially important.

If carputils is still not recognized, you could try putting your settings.yaml file under "$HOME/.config/carputils/", as suggested by Marie in a previous post: https://opencarp.org/q2a/305/installing-opencarp-and-carputils-on-linux-cluster

Several months ago I was struggling to link carputils and this was the final trick for me. However, things may have changed since the latest openCARP update.
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...