question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

image not found in Mac OS 2.0.0 install from PyPi.

See original GitHub issue

In a fresh environment. I installed python -m pip install pyscf The .whl that was downloaded was pyscf-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl It installed properly but when I tried to import pyscf.

Python 3.9.7 (default, Oct 13 2021, 06:45:31) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyscf
Traceback (most recent call last):
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/misc.py", line 54, in load_library
    return numpy.ctypeslib.load_library(libname, _loaderpath)
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/numpy/ctypeslib.py", line 149, in load_library
    return ctypes.cdll[libpath]
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 449, in __getitem__
    return getattr(self, name)
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 444, in __getattr__
    dll = self._dlltype(name)
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/libcgto.dylib, 6): Library not loaded: @rpath/libcint.4.dylib
  Referenced from: /Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/libcgto.dylib
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/__init__.py", line 114, in <module>
    from pyscf import gto
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/gto/__init__.py", line 19, in <module>
    from pyscf.gto import mole
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/gto/mole.py", line 46, in <module>
    from pyscf.gto import moleintor
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/gto/moleintor.py", line 29, in <module>
    libcgto = lib.load_library('libcgto')
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/misc.py", line 62, in load_library
    return numpy.ctypeslib.load_library(libname, libpath)
  File "/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/numpy/ctypeslib.py", line 149, in load_library
    return ctypes.cdll[libpath]
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 449, in __getitem__
    return getattr(self, name)
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 444, in __getattr__
    dll = self._dlltype(name)
  File "/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/libcgto.dylib, 6): Library not loaded: @rpath/libcint.4.dylib
  Referenced from: /Users/jamesbrown/Documents/Coding/environments/pyscftest2/lib/python3.9/site-packages/pyscf/lib/libcgto.dylib
  Reason: image not found

When I go to /lib/python3.9/site-packages/pyscf/lib/libcgto.dylib and run

(pyscftest2) jamesbrown@MacBook Pro: jamesbrown lib % otool -l libcgto.dylib | grep libcint && otool -l libcgto.dylib | grep RPATH -A 2 
       name @rpath/libcint.4.dylib (offset 24)
        cmd LC_RPATH
    cmdsize 80
       path /Users/qssun/workspace/pyscf/pypi/pyscf-2.0/pyscf/lib/deps/lib (offset 12)
--
        cmd LC_RPATH
    cmdsize 80
       path /Users/qssun/workspace/pyscf/pypi/pyscf-2.0/pyscf/lib/deps/lib64 (offset 12)
--
        cmd LC_RPATH
    cmdsize 32
       path /usr/local/lib64 (offset 12)
--
        cmd LC_RPATH
    cmdsize 72
       path /Users/qssun/workspace/pyscf/pypi/pyscf-2.0/pyscf/lib (offset 12)

The installation works when I build from setup.py after cloning the git repository.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22

github_iconTop GitHub Comments

2reactions
sunqmcommented, Nov 8, 2021

Installing libcint and then pip installing from GitHub seems to do the trick on arm64. (I imagine that it would also work for x86 and rosetta) I don’t get any import errors for just pure pyscf code. But now it seems I must open an issue for some packages which use pyscf as a dependency. If anything I dig up there points back to pyscf, I will open a separate issue if it seems appropriate. Thank you for your help!

In next release, the source code and makefiles will be included in the sdist file on pypi.

1reaction
JamesB-1qbitcommented, Nov 8, 2021

The new wheel worked for me! I assume this issue can be closed now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

imaginAIry - PyPI
ImaginAIry. Downloads image Code style: black Python Checks. AI imagined images. Pythonic generation of stable diffusion images. "just works" on Linux ...
Read more >
How to install Tensorflow on the Apple M1 Notebook
python -m pip install tensorflow-macos will run Python 2 and ask it to install tensorflow which is why you're getting the error that...
Read more >
Python module not found even though "Requirement Already ...
Run in command prompt. pip list. Check what version you have installed on your system if you have an old version.
Read more >
Installation - Pillow (PIL Fork) 9.3.0 documentation
Pillow >= 1.0 no longer supports import Image . ... We provide binaries for macOS for each of the supported Python versions in...
Read more >
Installation from PyPI - Apache Airflow
Installing via Poetry or pip-tools is not currently supported. If you wish to install airflow using those tools you should use the constraints...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found