madamow / pymoogi

python wrapper for MOOG. All plots are handled with matplotlib.
10 stars 4 forks source link

ModuleNotFoundError: No module named 'pymoogi' #5

Closed jonathancg77 closed 2 years ago

jonathancg77 commented 4 years ago

This is the error I get when I try to run pymoogi. I followed the instructions. I was able to successfully run make pymoogi and added it to the environment path as well. Also, I am using python3.7.8 on ubuntu 18.04.

I am just trying to figure out how to resolve this issue.

Traceback (most recent call last):
  File "/usr/local/bin/pymoogi", line 11, in <module>
    load_entry_point('pyMOOGi==1.0.0', 'console_scripts', 'pymoogi')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'pymoogi'
thomashzhang commented 4 years ago

I was pairing with @jonathancg77 but haven't tried this myself. Can confirm the error details.

madamow commented 4 years ago

Could you send me outputs from these to commands? find /usr/local -iname "pymoogi*.egg" and head -n 2 /usr/local/bin/pymoogi

jonathancg77 commented 4 years ago

After running:

find /usr/local -iname "pymoogi*.egg"

I get this output:

/usr/local/lib/python3.6/dist-packages/pyMOOGi-1.0.0-py3.6.egg                                                                                                                                                     
/usr/local/lib/python3.7/dist-packages/pyMOOGi-1.0.0-py3.7.egg                                                                                                                                                     

After running:

head -n 2 /usr/local/bin/pymoogi

I get this output:

#!/usr/bin/python3  
# EASY-INSTALL-ENTRY-SCRIPT: 'pyMOOGi==1.0.0','console_scripts','pymoogi'                                                                                                                                                                                                
madamow commented 4 years ago

I was able to recreate your error by running setup.py with one distribution of python and then trying to execute pyMOOGi with the other. If you installed python3.7 just for pymoogi - uninstall it and remove pymoogi from /usr/local/lib. pyMOOGi will work with python3.6 (current default for ubuntu). Run the setup again and tell me if the problem is still there.

If you need python3.7 and 3.6 for some reason, be sure that you run setup.py and pyMOOGi with the same version. I was able to successfully run pymoogi with your version of ubuntu and default python distribution for it. So my guess is the problem is with two python distributions.

jonathancg77 commented 4 years ago

I believe that I was getting the same issue when I just had the default python3.6.

I know in your instructions you said to the run the command python setup.py install, but it seemed I did not have permission to do that. Instead I used sudo python3 setup.py install. I also changed the my default python3 to be python3.7 so that i can setup and execute pyMOOGi with the same version.

madamow commented 4 years ago

Try using this (without sudo): python3.7 setup.py install --user

jonathancg77 commented 4 years ago

I just purged my python3.7. I ran python3.6 ../../setup.py install --user from the moog directory.

And I got this output:

running install
running bdist_egg
running egg_info 
writing pyMOOGi.egg-info/PKG-INFO 
writing dependency_links to pyMOOGi.egg-info/dependency_links.txt
writing entry points to pyMOOGi.egg-info/entry_points.txt 
writing top-level names to pyMOOGi.egg-info/top_level.txt
reading manifest file 'pyMOOGi.egg-info/SOURCES.txt'
writing manifest file 'pyMOOGi.egg-info/SOURCES.txt' 
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install  

creating build/bdist.linux-x86_64/egg 
creating build/bdist.linux-x86_64/egg/EGG-INFO   
copying pyMOOGi.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO 
copying pyMOOGi.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO 
copying pyMOOGi.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO 
copying pyMOOGi.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pyMOOGi.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO 
zip_safe flag not set; analyzing archive contents... 
creating 'dist/pyMOOGi-1.0.0-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it 
removing 'build/bdist.linux-x86_64/egg' (and everything under it) 
Processing pyMOOGi-1.0.0-py3.6.egg 
Removing /home/astrocabs77/.local/lib/python3.6/site-packages/pyMOOGi-1.0.0-py3.6.egg 
Copying pyMOOGi-1.0.0-py3.6.egg to /home/astrocabs77/.local/lib/python3.6/site-packages 
pyMOOGi 1.0.0 is already the active version in easy-install.pth 
Installing pymoogi script to /home/astrocabs77/.local/bin 

Installed /home/astrocabs77/.local/lib/python3.6/site-packages/pyMOOGi-1.0.0-py3.6.egg 
Processing dependencies for pyMOOGi==1.0.0 
Finished processing dependencies for pyMOOGi==1.0.0 
madamow commented 4 years ago

Try to run pymoogi now. Go to example and try: /home/astrocabs77/.local/bin/pymoogi synth_example.par

jonathancg77 commented 4 years ago

I just ran that command. I get the same error from before ModuleNotFoundError: No module named 'pymoogi'

jonathancg77 commented 4 years ago

Do I have to change any paths in the Moog.f file?

madamow commented 4 years ago

Do I have to change any paths in the Moog.f file?

No. Your error is not connected to any *.f file.

madamow commented 4 years ago

I installed docker with your version of ubuntu and python and I was able to run pymoogi. Your error must be connected with something being wrong with your python installation.

madamow commented 4 years ago

Another thing you can try is to install pymoogi in a virtual environment. Just execute (one by one) all commands I listed below:

cd /tmp
python3.6 -m pip install --user virtualenv
virtualenv -p $(which python3.6) moog_venv
. ./moog_venv/bin/activate
# prompt should have (moog_venv) at the beginning now
pip install scipy matplotlib pyqt5
git clone https://github.com/madamow/pymoogi
cd pymoogi
make -C pymoogi/moog
export MOOGPATH=$PWD/pymoogi/moog
pip install .
cd example
pymoogi abfind_example.par