cvg / pixel-perfect-sfm

Pixel-Perfect Structure-from-Motion with Featuremetric Refinement (ICCV 2021, Best Student Paper Award)
Apache License 2.0
1.29k stars 132 forks source link

ModuleNotFoundError: No module named 'pixsfm.refine_hloc' #127

Closed Legend94rz closed 7 months ago

Legend94rz commented 7 months ago

I have created a clean environment using conda: conda create -n python==3.10. Then I install pixsfm and pytorch (and other deps): conda install pytorch torchvision torchaudio pytorch-cuda pixsfm -c pytorch -c nvidia -c conda-forge.

Now, if I write from pixsfm.refine_hloc import PixSfM will give error: ModuleNotFoundError: No module named 'pixsfm.refine_hloc'.

I tried to install hloc then: conda install hloc -c conda-forge, but it doesn't work.

Could you please give some help?

Legend94rz commented 7 months ago

In fact, import other sub-module of pixsfm will give similar error, e.g.:

Python 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:24:10) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pixsfm.refine_hloc import PixSfM
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pixsfm.refine_hloc'
>>> import pixsfm
>>> pixsfm
<module 'pixsfm' (<_frozen_importlib_external._NamespaceLoader object at 0x7f7fe69c7130>)>
>>> from pixsfm.util.visualize import init_image, plot_points2D
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pixsfm.util'
>>> from pixsfm import ostream_redirect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'ostream_redirect' from 'pixsfm' (unknown location)
>>> dir(pixsfm)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
gregogalante commented 7 months ago

@Legend94rz I'm getting the same problem. Did you find a solution?

Legend94rz commented 7 months ago

@Legend94rz I'm getting the same problem. Did you find a solution?

not yet

Tobias-Fischer commented 7 months ago

See https://github.com/conda-forge/pixsfm-feedstock/pull/7 - I'm working on it

Tobias-Fischer commented 7 months ago

Should be all good now with the latest build.

Legend94rz commented 7 months ago

@Tobias-Fischer Hi, really thanks for your help! I have re-create a new env and reinstall pixsfm via conda. it seems like the problem still exists... the version pixsfm I installed is: pixsfm 1.0.0 py310h64457ac_2 conda-forge is it correct?

Tobias-Fischer commented 7 months ago

No, you want build number 3 instead of 2 as you currently have. Can you try creating a new environment with just pixsfm in there?

Legend94rz commented 7 months ago

I'm using this cmd: conda create -n pixsfm pixsfm -c pytorch -c nvidia -c conda-forge

here are some versions of installing packages:

colmap-3.8                 |  gpuh7f4bfd4_109        68.8 MB  conda-forge
cudatoolkit-11.8.0         |      h4ba93d1_12       682.8 MB  conda-forge
pixsfm-1.0.0               |  gpuhe00762b_103         2.4 MB  conda-forge
pycolmap-0.4.0             |cuda112py311h35f17e9_5        34.0 MB  conda-forge
pyparsing-3.1.1            |     pyhd8ed1ab_0          87 KB  conda-forge
python-3.11.6              |hab00c5b_0_cpython        29.3 MB  conda-forge
pytorch-2.0.0              |cpu_generic_py311h495eaba_4        69.3 MB  conda-forge

the installing pytorch may not support CUDA.. Maybe I need install pixsfm first and then re-install pytorch from official?

Tobias-Fischer commented 7 months ago

Hiya - try mamba create -n pixsfm pixsfm pytorch-gpu -c conda-forge which works for me :) (general comment: try and not mix different channels, I use conda-forge for everything)

Legend94rz commented 7 months ago

Hiya - try mamba create -n pixsfm pixsfm pytorch-gpu -c conda-forge which works for me :) (general comment: try and not mix different channels, I use conda-forge for everything)

I tried your cmd and now pixsfm works fine. Thank you!

liyupeng-ing commented 3 months ago

from pixsfm.refine_hloc import PixSfM Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/lyp/miniforge3/envs/pixsfm-test/lib/python3.11/site-packages/pixsfm/__init__.py", line 25, in <module> pyceres.glog.minloglevel = 4 ^^^^^^^^^^^^ AttributeError: module 'pyceres' has no attribute 'glog' hi! i get some error, can you give me some help? Thank you!

pixsfm 1.0.0 gpuhf31afc4_105 conda-forge/linux-64 3MB

Tobias-Fischer commented 3 months ago

See https://github.com/conda-forge/pixsfm-feedstock/issues/15