timeflux / timeflux_rasr

Implementation of rASR filtering.
MIT License
26 stars 4 forks source link

No setup.py for installing #32

Closed Hororohoruru closed 4 years ago

Hororohoruru commented 4 years ago

Hello, I just cloned the repo to try the analysis on some data, but I cannot seem to find the setup file to pip install the repo on the virtual environment.

Thank you.

lkorczowski commented 4 years ago

Hi, @Hororohoruru

setup may not be required here as you can use conda env create to import the requirements, see https://github.com/bertrandlalo/timeflux_rasr#installation

Tell me if you succeeded or if you need more help.

Hororohoruru commented 4 years ago

Hi @lkorczowski

I have indeed installed the dependencies with the provided environment file, but when trying to run one of the notebooks, it raises an import error relative to the rasr package (utils module).

Although all the requirements are installed, the README file specifies that the module needs to be installed after using the pip install -e . command, but this requires a setup.py file, afaik.

lkorczowski commented 4 years ago

Could you copy/past your NB error ?

Hororohoruru commented 4 years ago

Yes:

ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /home/dcas/j.torre-tresols/gitrepos/timeflux_rasr

Edit: Sorry I just realized you are asking for the notebook error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-6dc9b104b92b> in <module>
----> 1 from utils.config import Config
      2 
      3 from collections import OrderedDict
      4 
      5 from glob import glob

ModuleNotFoundError: No module named 'utils'
lkorczowski commented 4 years ago

In that case, I believe it is just because the git repo is not yet in your python path (some IDE add it automaticaly). Try adding

import sys
sys.path.append(PATH + '/../')

at the beginning of your NB.

Mind you that Config module requires that you have the data on your computer, and add your username and datapath here: https://github.com/bertrandlalo/timeflux_rasr/blob/9ad3087615d25cd4315ee78166333a77591ee868/utils/config.py#L13-L16

Config is therefore a development module that will be removed when releasing.

If you really want to use the NB on your data, I advice you to take the NB from the last version (waiting for review) https://github.com/bertrandlalo/timeflux_rasr/pull/30 (i.e. this NB) You can delete the from utils.config import Config and use your own data.

Hororohoruru commented 4 years ago

The README file of the repo clearly states to run pip install on the root after creating the conda environment, I don't think there is a need to manually add the path to the repo. Although I can manually add the path to all the scripts I make that use this code, would not be easier to be able to add it to the installed packages and just import it directly?

lkorczowski commented 4 years ago

I'm not sure to understand completely

The README file of the repo clearly states to run pip install on the root after creating the conda environment, I don't think there is a need to manually add the path to the repo.

Activate on the root of the repo folder (not anywhere else) but yes, you are right. Activating the environment should also make the path available. Using sys.path.append(PATH + '/../') in the NB is just a workaround if your environment didn't have the correct path.

Although I can manually add the path to all the scripts I make that use this code, would not be easier to be able to add it to the installed packages and just import it directly?

I believe you want to being able to do import timeflux_rasr from anywhere not only from the repo folder, don't you ? In that case : there is another issue here : this code is not yet ready for production so the code is only accessible from the repo folder itself (for now).

What we need to do before being able to import from anywhere :

Hororohoruru commented 4 years ago

I see, I think I understand now. Thank you very much for giving me the information!