-
Notifications
You must be signed in to change notification settings - Fork 23
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
ModuleNotFoundError: No module named 'torch_persistent_homology.persistent_homology_cpu' #13
Comments
Thanks for reaching out! This looks like a problem with the current environment. Can you check whether the module shows up with |
you mean |
I actually meant |
When I use
and I checked with both
In
|
Can you import the parent module, i.e. does |
It works.
|
What does |
I'm not sure what you mean. You mean use it in the Python concole?
|
Yes, of course. You can see that the module was not installed correctly—addition submodules are missing. Please repeat the installation of the module, make sure that no cache is being used, and/or try to build the module from source. Sorry for the hassle. |
OK, when I install the module in Win10 I met many problems with |
You can use the module without (I would not try to install anything under Windows, though—I have no clue how I'll close this issue for now, please reopen one in the other repo. |
Hi, I was introduced to this repo through a collaborator. I've attempted to clone TOGL and the submodule (torch-persistent-homology), and those were done with no problem. I'm working within a virtual environment on a MacOS, and executed a Additional note: |
Has the submodule been cloned correctly? This looks like nothing was installed. I have started a new implementation in |
Thanks for the quick response. Here's the clone command I executed, after changing directory into the empty
The last command outputs:
Following that, I executed Also, (1) is |
Just seeing the code you linked. So it looks like the |
So,
|
Did a Processing ~/Documents/Quantopo/repos/TOGL/repos/torch_persistent_homology
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: torch<2.0.0,>=1.7.1 in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch-persistent-homology==0.1.0) (1.8.1)
Requirement already satisfied: numpy in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch<2.0.0,>=1.7.1->torch-persistent-homology==0.1.0) (1.21.6)
Requirement already satisfied: typing-extensions in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch<2.0.0,>=1.7.1->torch-persistent-homology==0.1.0) (4.2.0)
Building wheels for collected packages: torch-persistent-homology
Building wheel for torch-persistent-homology (PEP 517) ... done
Created wheel for torch-persistent-homology: filename=torch_persistent_homology-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl size=5988 sha256=e5ef4122357c08b6ffc030fa2fb331cc6d9734c80dbfe61da99c9ea343ebf8fb
Stored in directory: /private/var/folders/s5/nw5tmhys4dxbjvwyls5lg2hm0000gn/T/pip-ephem-wheel-cache-y8fvkif0/wheels/e6/97/7f/f0d25e6b959124443fd3d1a44966477a0eed6983ac5ae09a2d
Successfully built torch-persistent-homology
Installing collected packages: torch-persistent-homology
Successfully installed torch-persistent-homology-0.1.0 Following that, I enter into python shell and attempt to import Struggling with pinpointing the issue. I'm also not seeing the shared object file in my virtual environment Python library under |
And where's the file |
I don't see a wheel file produced anywhere. I've also tried cloning the from setuptools import setup, Extension
from torch.utils import cpp_extension
torch_library_paths = cpp_extension.library_paths(cuda=False)
def build(setup_kwargs):
"""
This function is mandatory in order to build the extensions.
"""
setup_kwargs.update({
'ext_modules': [
cpp_extension.CppExtension(
'torch_persistent_homology.persistent_homology_cpu',
['torch_persistent_homology/perisistent_homology_cpu.cpp'],
extra_link_args=[
'-Wl,-rpath,' + library_path
for library_path in torch_library_paths]
)
],
'cmdclass': {
'build_ext': cpp_extension.BuildExtension
}
}) As you can see, the module |
To my understanding, |
New versions of |
This was the screen output when executing pip install, which shows a wheel file was created, but it doesn't exist when I try to go to that location: Processing ~/Documents/Quantopo/repos/TOGL/repos/torch_persistent_homology
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: torch<2.0.0,>=1.7.1 in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch-persistent-homology==0.1.0) (1.8.1)
Requirement already satisfied: typing-extensions in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch<2.0.0,>=1.7.1->torch-persistent-homology==0.1.0) (4.2.0)
Requirement already satisfied: numpy in ~/.pyenv/versions/3.8.6/envs/TOGL_venv/lib/python3.8/site-packages (from torch<2.0.0,>=1.7.1->torch-persistent-homology==0.1.0) (1.21.6)
Building wheels for collected packages: torch-persistent-homology
Building wheel for torch-persistent-homology (pyproject.toml) ... done
Created wheel for torch-persistent-homology: filename=torch_persistent_homology-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl size=5988 sha256=e5ef4122357c08b6ffc030fa2fb331cc6d9734c80dbfe61da99c9ea343ebf8fb
Stored in directory: /private/var/folders/s5/nw5tmhys4dxbjvwyls5lg2hm0000gn/T/pip-ephem-wheel-cache-5sbvjo9d/wheels/e6/97/7f/f0d25e6b959124443fd3d1a44966477a0eed6983ac5ae09a2d
Successfully built torch-persistent-homology
Installing collected packages: torch-persistent-homology
Successfully installed torch-persistent-homology-0.1.0 However, I followed up with executing Preparing build environment with build-system requirements poetry-core>=1.0.0, setuptools, torch
Building torch-persistent-homology (0.1.0)
/var/folders/s5/nw5tmhys4dxbjvwyls5lg2hm0000gn/T/tmpf8gr4tkl/.venv/lib/python3.8/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), I've tried the import again and still get same error: >>> from torch_persistent_homology.persistent_homology_cpu import compute_persistence_homology_batched_mt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch_persistent_homology.persistent_homology_cpu'
>>> |
OK! I think the build is not running in this case....let's see what @ExpectationMax says, or move to |
Ok, thanks. Will wait for his response. Myself and my collaborators are interested in |
Hi @Pseudomanifold, few questions about
|
We should move this conversation to ad 1: Yes. |
Hi, since my research plan have changed, I start to reactivate this program now. This time I follow ReadMe strictly to install the environment on Linux server, but I still meet the same problem.
First I create a conda virtual environment named PoetryEnv with python=3.8, then I install pipx and poetry using command
then I activate this environment, enter the folder TOGL, and command
it goes well, but when I run train_model.py, it report errors.
it seems that the poetry dependency doesn't contain CUDA, and at the same time I found that in poetry dependency, it requires torch==1.8.1 and installed it automatically,
but in deps.py, it requires torch==1.7.0.
so I downgrade torch and install CUDA with
then there is a version conflict between numpy and scipy, I downgrade numpy==1.21.6, and then I get the same problem.
I trid to use two way to reinstall this package, but they don't work.
So I can only ask for your help, thank you. |
Hi, I think it's easiest to use the new implementation here that I described in this comment: #13 (comment) |
OK, it's also my alternative option, thank you again. |
Hi, thank you for your codebase. While I set the environment for torch-persistent-homology in Win10 system, I met many problems. So I changed to a Ubuntu server. I read the issues in https://github.com/ExpectationMax/torch_persistent_homology/issues/1, so I use Anaconda3 to bulid a Python3.8 virtual envrionment and installed torch==1.12.1, torch-geometric==2.1.0, scipy==1.7.3. Then I installed torch-persistent-homology with the command
pip install .
, it goes well. And I checked my environment withconda list
, it's listed up there. But when I trid to test it with>>> from torch_persistent_homology.persistent_homology_cpu import compute_persistence_homology_batched_mt
The result comes to an error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch_persistent_homology.persistent_homology_cpu'
I don't know why I still can't use it, so I would like to ask for your help, thank you.
The text was updated successfully, but these errors were encountered: