SARRA-cropmodels / SARRA-Py

GNU General Public License v3.0
5 stars 1 forks source link

Import error of sarra_py in the notebook #2

Closed remydecoupes closed 1 year ago

remydecoupes commented 1 year ago

The import box from notebook stops when importing sarra_py:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 10
      8 import io
      9 import xarray as xr
---> 10 from sarra_py import *
     11 import time

ModuleNotFoundError: No module named 'sarra_py'
codename5281 commented 1 year ago

Hello @remydecoupes, thanks for your feedback.

By following the installation instructions from the README file, and passing a git checkout dev before installing the package via pip install . (as the current code isn't in the main branch yet) i wasn't able to replicate this issue.

Could you provide more information about how you did it ?

remydecoupes commented 1 year ago

You're right, I forgot to mention it.

I was working on the dev branch and my development environment was as I described in the pull request #1:

I'm going to re-test it. I'll let you know.

codename5281 commented 1 year ago

I just tested it by using the conda development environment setup you suggested in your pull request #1 - now merged, except that i use the VScode Jupyter instance instead of the suggested jupyterlab install. By running the VScode Jupyter instance's IPython kernel on the sarra_py conda environment suggested in the updated README, i don't have any import issue.

remydecoupes commented 1 year ago

I have just tried to import sarra_py and I still have the same import error.

When I list the packages installed in my conda env, I don't see any package related to sarra_py:

(sarra_py) user$ conda list |grep sarra
# packages in environment at mambaforge/envs/sarra_py:

I was able to import it by adding those 2 lines in the import box:

import sys
sys.path.append('./../src/')
remydecoupes commented 1 year ago

Sorry, I didn't follow the readme instructions. I run pip install -r requirements.txt instead of pip install . Now I see sarra-py in my conda env and I can import it.