Open mpanning opened 1 year ago
As a minor update, basemap can be installed from the anaconda channel if python is set to 3.10 instead of 3.11. But the pip install of instaseis still failed. I will attempt via git next. Here's the pip error:
gfortran -O -fPIC -c -ffree-form instaseis/src/finite_elem_mapping.f90 -o build/temp.macosx-11.0-arm64-cpython-310/instaseis/src/finite_elem_mapping.o
instaseis/src/finite_elem_mapping.f90:49:9:
49 | use global_parameters, only : sp, dp, pi
| 1
Fatal Error: Cannot open module file 'global_parameters.mod' for reading at (1): No such file or directory
compilation terminated.
error: command '/opt/local/bin/gfortran' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for instaseis Failed to build instaseis ERROR: Could not build wheels for instaseis, which is required to install pyproject.toml-based projects
Installing via the git repo is also failing due to non-compliant versioning according to PEP 440:
/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-build-env-gyi05z4t/overlay/lib/python3.10/site-packages/setuptools/dist.py:315: SetuptoolsDeprecationWarning: Invalid version: '1.4.2-5-gdc9d4'. !!
********************************************************************************
The version specified is not a valid version according to PEP 440.
This may not work as expected with newer versions of
setuptools, pip, and PyPI.
This deprecation is overdue, please update your project and remove deprecated
calls to avoid build errors in the future.
See https://peps.python.org/pep-0440/ for details.
********************************************************************************
raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '1.4.2-5-gdc9d4' error: subprocess-exited-with-error
with the final build error looking like this:
× Getting requirements to build editable 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. full command: /Users/panning/anaconda3/envs/instaseis2/bin/python3.10 /Users/panning/anaconda3/envs/instaseis2/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_editable /var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/tmpwh841jax cwd: /Users/panning/git/instaseis Getting requirements to build editable ... error error: subprocess-exited-with-error
× Getting requirements to build editable 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.
Forcing the version number to remove the alphanumeric git version extension works for fixing the above error, but then just leads to the global_parameters.mod error in the non-git install. This one comes from pip apparently building the f90 modules in the wrong order, trying to build finite_elem_mapping.f90 before global_parameters.f90, despite the order being set correctly in ext_modules in setup.py. I'm not sure why it's compiling in the wrong order, and how to fix that.
I cannot deep-dive into this right now, but the issue seems to be that you're on an Apple CPU. On my Intel MacBook, installation via conda-forge still works.
I'll come back to you...
@sstaehler's fork fixes the version and compile order issues in a python 3.10 environment after a little work for the dependencies (basemap is challenging, and for some reason I had to upgrade scipy in order to actually import instaseis due to some incompatibility with the liblapack installation). In 3.11, I tried the same process, and eventually got all the dependencies installed, I think, but the compile failed when linking the f90 modules due to something probably messed up in some environment variable, but the error doesn't say what it couldn't find when linking:
Building wheels for collected packages: instaseis Running command Building editable for instaseis (pyproject.toml) /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-build-env-z8z_kdos/overlay/lib/python3.10/site-packages/setuptools/dist.py:314: InformationOnly: Normalizing '0.0.0.dev+0.g1b71b1f112' to '0.0.0.dev0+0.g1b71b1f112' self.metadata.version = self._normalize_version( running editable_wheel creating /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info writing /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/PKG-INFO writing dependency_links to /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/dependency_links.txt writing requirements to /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/requires.txt writing top-level names to /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/top_level.txt writing manifest file '/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/SOURCES.txt' reading manifest file '/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'instaseis/RELEASE-VERSION' adding license file 'LICENSE.txt' writing manifest file '/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis.egg-info/SOURCES.txt' creating '/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis-0.0.0.dev0+0.g1b71b1f112.dist-info' creating /private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-wheel-or3hkps9/.tmp-_ibdyact/instaseis-0.0.0.dev0+0.g1b71b1f112.dist-info/WHEEL running build_py running build_ext building 'instaseis' extension creating /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis creating /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src gfortran -O -fPIC -c -ffree-form instaseis/src/all_global_parameters.f90 -o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/all_global_parameters.o gfortran -O -fPIC -c -ffree-form instaseis/src/finite_elem_mapping.f90 -o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/finite_elem_mapping.o gfortran -O -fPIC -c -ffree-form instaseis/src/sem_derivatives.f90 -o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/sem_derivatives.o gfortran -O -fPIC -c -ffree-form instaseis/src/spectral_basis.f90 -o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/spectral_basis.o creating /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmpnzx2yxx.build-lib/instaseis creating /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmpnzx2yxx.build-lib/instaseis/lib clang -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/panning/anaconda3/envs/instaseis/lib -L/Users/panning/anaconda3/envs/instaseis/lib -Wl,-rpath,/Users/panning/anaconda3/envs/instaseis/lib -L/Users/panning/anaconda3/envs/instaseis/lib /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/all_global_parameters.o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/finite_elem_mapping.o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/sem_derivatives.o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmptio24qn.build-temp/instaseis/src/spectral_basis.o -lgfortran -o /var/folders/ks/n_mh2ls1g143zxmjky425v40000gq/T/tmpnzx2yxx.build-lib/instaseis/lib/instaseis.cpython-310-darwin.so ld: warning: duplicate -rpath '/Users/panning/anaconda3/envs/instaseis/lib' ignored ld: duplicate LC_RPATH '@loader_path' in '/Users/panning/anaconda3/envs/instaseis/lib/libgfortran.5.dylib' clang: error: linker command failed with exit code 1 (use -v to see invocation) Traceback (most recent call last): File "/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-build-env-z8z_kdos/overlay/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 266, in link self.spawn(linker + ld_args) File "/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-build-env-z8z_kdos/overlay/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/private/var/folders/ks/n_m_h2ls1g143zxmjky425v40000gq/T/pip-build-env-z8z_kdos/overlay/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit code 1
To be fair, I now also get this error when I try to start from scratch in 3.10 as well, which is fairly confusing, since I have a saved environment (which I may never touch again for fear of breaking it) in which it worked, and I was able to import and use instaseis successfully.
Building from @sstaehler fork now works for 3.11 as well with the following modifications:
extra_link_args = ["-ld64"]
pip install -v -e .
in the git repository, import it into a code and use it.Dear meaning, I followed your steps but was not sure how to add the element to My Extension. I have the following in setup.py: lib = MyExtension( "instaseis", libraries=["gfortran"], library_dirs=get_libgfortran_dir(),
sources=[
os.path.join(src, "all_global_parameters.f90"),
os.path.join(src, "finite_elem_mapping.f90"),
os.path.join(src, "spectral_basis.f90"),
os.path.join(src, "sem_derivatives.f90"),
],
extra_link_args=["-ld64"],
) Is that what you mean? For me, this fails with: File "/Users/phil/Dropbox/Software/instaseis/instaseis/version.py", line 198, in _normalize_version local_version = version.group(2).lower() ^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group' error: subprocess-exited-with-error
Any idea what could be wrong?
Has there been any update on this?
I am using a Apple M2 Mac. Instaseis was not found through conda and the direct pip installation did not work. Following the developer installation (https://instaseis.net/#developer-installation) failed, similar to @mpanning with:
error: command '/usr/bin/clang' failed with exit code 1
I tried to include extra_link_args = ["-ld64"]
within setup.py similar to @PRCseismo, however, I received the same subprocess-exited-with-error.
@mpanning , where exactly did you include it such that it worked for you?
Thanks, Fabian
I'm not sure if this is the right venue to mention this, but I just tried to reinstall my instaseis environment on a new computer, and the condo install no longer works through conda-forge, with the follow error message:
PackagesNotFoundError: The following packages are not available from current channels:
Current channels:
To search for alternate channels that may provide the conda package you're looking for, navigate to
and use the search bar at the top of the page.
I'm trying to install dependencies separately, but basemap is also not installing, and so I haven't attempted the instaseis install yet. For reference, this is the uninformative basemap error:
Solving environment: \ Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions