hyperion-rt / hyperion

Hyperion Radiative Transfer Code
http://www.hyperion-rt.org
BSD 2-Clause "Simplified" License
52 stars 26 forks source link

ModuleNotFoundError: No module named 'hyperion._version' #227

Closed prerakgarg07 closed 2 years ago

prerakgarg07 commented 2 years ago

After the changes made to the version.py in commit #226 Hyperion throws the following error

In [1]: import hyperion
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import hyperion

File ~/codes/hyperion_base/hyperion/__init__.py:3, in <module>
      1 from __future__ import print_function, division
----> 3 from .version import __version__
      5 # Set up the test function
      6 _test_runner = None

File ~/codes/hyperion_base/hyperion/version.py:1, in <module>
----> 1 from hyperion._version import version as __version__
      2 __dev__ = 'dev' in __version__

ModuleNotFoundError: No module named 'hyperion._version'

My Hyperion installation instructions

git clone https://github.com/hyperion-rt/hyperion.git
cd hyperion
python setup.py install
git submodule init
git submodule update
./configure --prefix=$PATH TO MY ANACONDA 
make
make install 

There is no _version.py in my Hyperion directory. I tried to debug this and all I could find was that the file pyproject.toml has the command write_to = "hyperion/_version.py" but I don't know to execute it.

Is this a bug or do I need to update how I am installing Hyperion?

astrofrog commented 2 years ago

Could you try running:

pip install .

Instead of

python setup.py install

?

prerakgarg07 commented 2 years ago

Tried it with pip install . , still getting the same error

astrofrog commented 2 years ago

What directory are you running ipython from? (make sure that it is not the root of the hyperion source directory)

prerakgarg07 commented 2 years ago

Yeah, that's it. This error is only thrown when running from the Hyperion source directory. Thanks a lot for your help

P.S: Sorry for the late response. I had some trouble with my python installation

indebetouw commented 1 year ago

I get this when I install from git, python setup.py install within a miniforge env. (I'm not starting python in the install dir) Thanks

astrofrog commented 1 year ago

Have you tried pip install as mentioned above?

indebetouw commented 1 year ago

that worked better thanks - I didn't realize I could pip install the local package. Needed more coffee...