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

ImportError: cannot import name 'topo_core' #12

Open
langford77840 opened this issue Jan 27, 2022 · 3 comments
Open

ImportError: cannot import name 'topo_core' #12

langford77840 opened this issue Jan 27, 2022 · 3 comments

Comments

@langford77840
Copy link

langford77840 commented Jan 27, 2022

  • topocalc version: 0.5.0
  • Python version: 3.8.0
  • Operating System: Ubuntu 18.04

Description

slope, aspect calculation worked well.
But, I can't calculate svf, tvf with this error message.

ImportError Traceback (most recent call last)
/tmp/ipykernel_5913/83726565.py in
----> 1 from topocalc.viewf import viewf
2
3 # # Load the DEM into a numpy array
4 # dem_pre_path = 'dsm_ups_crs.tif'
5 # dem = rxr.open_rasterio(dem_pre_path)

~/workspace/topocalc/topocalc/viewf.py in
2
3 from topocalc.gradient import gradient_d8
----> 4 from topocalc.horizon import horizon
5
6

~/workspace/topocalc/topocalc/horizon.py in
1 import numpy as np
2
----> 3 from topocalc.core_c import topo_core
4 from topocalc.skew import adjust_spacing, skew
5

~/workspace/topocalc/topocalc/core_c/init.py in
1 # -- coding: utf-8 --
----> 2 from . import topo_core # noqa

ImportError: cannot import name 'topo_core' from partially initialized module 'topocalc.core_c' (most likely due to a circular import) (/home/workspace/topocalc/topocalc/core_c/init.py)

What I Did

I changed in' init.py' file from " from . import topo_core" to "from . import * ".
But another error message comes up as follows:

ImportError Traceback (most recent call last)
/tmp/ipykernel_15634/83726565.py in
----> 1 from topocalc.viewf import viewf
2
3 # # Load the DEM into a numpy array
4 # dem_pre_path = 'dsm_ups_crs.tif'
5 # dem = rxr.open_rasterio(dem_pre_path)

~/workspace/topocalc/topocalc/viewf.py in
2
3 from topocalc.gradient import gradient_d8
----> 4 from topocalc.horizon import horizon
5
6

~/workspace/topocalc/topocalc/horizon.py in
1 import numpy as np
2
----> 3 from topocalc.core_c import topo_core
4 from topocalc.skew import adjust_spacing, skew
5

ImportError: cannot import name 'topo_core' from 'topocalc.core_c' (/home/workspace/topocalc/topocalc/core_c/init.py)

I guess still I can't import topo_core properly.

Would you help me or give any suggestions to solve this issue???

Thanks in advance for your help.

@scotthavens
Copy link
Contributor

Sorry for the slow reply.

Are you installing this from source or from PyPi? It seems like you have the source code so you might need to have cython installed and then install topocalc with python3 setup.py install or python3 -m pip install .

@simonmarti1992
Copy link

Helllo
I have the same issue as @langford77840 , I cannot install the package properly on windows

@Hedrick-ARS
Copy link

Hi @simonmarti1992 - did you also try what @scotthavens suggested? On Windows you would need to be installing within a Docker environment running Ubuntu 18.04.

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

4 participants