kosiokarchev / phytorch

Utilities for physics with PyTorch
GNU General Public License v3.0
6 stars 2 forks source link

Importing from the same directory as where phytorch directory is located: missing __init__.py in special? #12

Open mjyb16 opened 1 year ago

mjyb16 commented 1 year ago

My installation of this code is now running! However, if I try to import phytorch from a Jupyter notebooks file which is located in the same directory where the phytorch directory is located, I get the error below. Usually I am able to import modules from a file in the home directory, so this is unexpected. I think adding an __init__.py file to the special directory would solve the issue. Creating a dummy directory and moving the notebook there solves the issue for now.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 1
----> 1 from phytorch.cosmology.drivers import abstract

File /lustre06/project/6061843/mjybarth/phytorch/phytorch/cosmology/__init__.py:2
      1 from . import core, special
----> 2 from .drivers import abstract, analytic, odeint

File /lustre06/project/6061843/mjybarth/phytorch/phytorch/cosmology/drivers/analytic.py:10
      8 from ._analytic_base import BaseAnalyticFLRWDriver, BaseAnalyticLambdaCDM, BaseAnalyticLambdaCDMR
      9 from .. import special
---> 10 from ...special.elliptic import ellipeinc, ellipkinc, ellippiinc, elliprc, elliprd, elliprf, elliprj
     11 from ...special.elliptic_reduction.symbolic import SymbolicEllipticReduction
     12 from ...utils._typing import _TN

ModuleNotFoundError: No module named 'phytorch.special'
kosiokarchev commented 1 year ago

It works fine for me although I haven't tried a clean install. Did you try adding the special/init.py file and does it actually solve the issue for you?