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 'SimplicialComplex' #27

Open
amiltonwong opened this issue Oct 31, 2020 · 3 comments
Open

ImportError: cannot import name 'SimplicialComplex' #27

amiltonwong opened this issue Oct 31, 2020 · 3 comments

Comments

@amiltonwong
Copy link

Hi, @bruel-gabrielsson ,

I had followed your guide on building C++ extensions, and the building process is finished without error. However, when import the packages as follows:

>>> import torch
>>> from topologylayer.nn import LevelSetLayer1D, SumBarcodeLengths

I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/code13/TopologyLayer/topologylayer/__init__.py", line 1, in <module>
    import topologylayer.nn
  File "/data/code13/TopologyLayer/topologylayer/nn/__init__.py", line 3, in <module>
    from .levelset import LevelSetLayer, LevelSetLayer1D, LevelSetLayer2D
  File "/data/code13/TopologyLayer/topologylayer/nn/levelset.py", line 1, in <module>
    from ..functional.sublevel import SubLevelSetDiagram
  File "/data/code13/TopologyLayer/topologylayer/functional/sublevel.py", line 6, in <module>
    from .persistence import SimplicialComplex, persistenceForwardCohom, persistenceBackward, persistenceForwardHom
ImportError: cannot import name 'SimplicialComplex'

For my another virtual environment, I use pip install git+https://github.com/bruel-gabrielsson/TopologyLayer.git to install it globally and the import commands run successfully.
Any hints to solve this issue?
THX!

My system information is the following:
operating system : ubuntu 16.04
Python version, environment setup: Python 3.6.5, with conda environment

@soham0209
Copy link

Adding to the previous comment:
Installing with pip install git+https://github.com/bruel-gabrielsson/TopologyLayer.git and running your examples in jupyter notebook reproduces the problem. However if I run as:
python3 holes.py
The program executes successfully.

@stal12
Copy link

stal12 commented May 12, 2021

@amiltonwong have you tried changing the current directory? It worked for me.
Check this answer.

@DanielNolte
Copy link

I ran into the same issues on Windows 10 with Python 3.10.4.

After creating a new environment, installing dependencies, and installing TopologyLayer, I realized the topologylayer folder was inside the .egg site-package folder: tmp/.conda/envs/ACTIVE_ENV/lib/site-packages/topologylayer-0.0.0-py3.10-win-amd64.egg/topologylayer

To fix the issue, I moved the topologylayer folder from tmp/.conda/envs/ACTIVE_ENV/lib/site-packages/topologylayer-0.0.0-py3.10-win-amd64.egg to tmp/.conda/envs/ACTIVE_ENV/lib/site-packages/, and now the import works

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