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

Can't import RVector3 when installing package #772

Closed
gabrahamastro opened this issue Sep 26, 2024 · 2 comments
Closed

Can't import RVector3 when installing package #772

gabrahamastro opened this issue Sep 26, 2024 · 2 comments

Comments

@gabrahamastro
Copy link

Problem

Having created the conda environment pg on Spyder as instructed by the installation instructions, when in the pg environment and trying to run the code
import pygimli as pg
an error comes up which reads
cannot import name 'RVector3' from 'pygimli.core.core'

Background

Operating system: MacOS 15.0 (x86_64)
Python version: 3.11.9
pyGIMLi version: 1.5.1
Sypder version: 6.0.1
Way of installation: Using conda

Steps to reproduce

I entered the pg conda environment by changing the default environment in the Consoles tab, before entering the below after having entered IPython automatically.

import pygimli as @@#pg

Expected behavior

This should import the package, with no error responses.

Actual behaviour

The package was not imported correctly, with the following output being generated:

import pygimli as pg
dlopen(/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/_pygimli_.so, 0x0002): Library not loaded: @rpath/libcholmod.3.dylib
  Referenced from: <8BABB57D-C0D2-33CC-9CFC-A1CCDED6DA32> /usr/local/Caskroom/miniforge/base/envs/pg/lib/libgimli.dylib
  Reason: tried: '/usr/local/Caskroom/miniforge/base/envs/pg/lib/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/bin/../lib/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/bin/../lib/libcholmod.3.dylib' (no such file), '/usr/local/lib/libcholmod.3.dylib' (no such file), '/usr/lib/libcholmod.3.dylib' (no such file, not in dyld cache)
Traceback (most recent call last):
  File "/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/core/core.py", line 11, in <module>
    from . import _pygimli_  # if it works: as pgcore, replace all _pygimli_
    ^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name '_pygimli_' from partially initialized module 'pygimli.core' (most likely due to a circular import) (/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/core/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/__init__.py", line 20, in <module>
    from ._pygimli_ import *
ImportError: dlopen(/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/_pygimli_.so, 0x0002): Library not loaded: @rpath/libcholmod.3.dylib
  Referenced from: <8BABB57D-C0D2-33CC-9CFC-A1CCDED6DA32> /usr/local/Caskroom/miniforge/base/envs/pg/lib/libgimli.dylib
  Reason: tried: '/usr/local/Caskroom/miniforge/base/envs/pg/lib/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pgcore/../../../../lib64/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/bin/../lib/libcholmod.3.dylib' (no such file), '/usr/local/Caskroom/miniforge/base/envs/pg/bin/../lib/libcholmod.3.dylib' (no such file), '/usr/local/lib/libcholmod.3.dylib' (no such file), '/usr/lib/libcholmod.3.dylib' (no such file, not in dyld cache)
ERROR: cannot import the library '_pygimli_'.
Traceback (most recent call last):

  Cell In[1], line 1
    import pygimli as pg

  File /usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/__init__.py:8
    from .core.decorators import (renamed, singleton, moduleProperty,

  File /usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/core/__init__.py:14
    from .base import (isInt, isScalar, isIterable, isArray, isPos, isR3Array,

  File /usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/core/base.py:7
    from .core import (RVector3, R3Vector, RMatrix)

ImportError: cannot import name 'RVector3' from 'pygimli.core.core' (/usr/local/Caskroom/miniforge/base/envs/pg/lib/python3.11/site-packages/pygimli/core/core.py)
@halbmy
Copy link
Contributor

halbmy commented Sep 26, 2024

This is related to an incompatible suitesparse version. Please have a look at #761 and the solution given there.

@gabrahamastro
Copy link
Author

When running the below in terminal as per #761 before retrying in Spyder, it worked perfectly - thank you @halbmy!
conda create -n pg -c gimli -c conda-forge "pygimli>=1.5.0" python=3.10 suitesparse=5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants