OpenSMFS / FRETBursts

Burst analysis software for single and multi-spot single-molecule FRET (smFRET) data.
https://opensmfs.github.io/FRETBursts/
GNU General Public License v2.0
12 stars 9 forks source link

Error importing fretbusts into Jupyter notebook #24

Closed mayeshh closed 5 years ago

mayeshh commented 5 years ago

I am getting this error when I try to import frebursts:

ModuleNotFoundError: No module named 'phrates_c'

I have cloned my forked copy of FRETBursts locally. I have tried removing and reinstalling FRETBursts multiple times to fix this problem, and each time I get the same error.

I had this trouble over the weekend, and I was able to fix it by deleting everything including my anaconda3 folder and reinstalling everything from scratch. After a couple of iterations, this eventually worked (still not sure why). Today, I had similar problems, but for different reasons (the nbextension was not installed correctly so I had to reinstall anaconda3 again). Finally I have my extensions working, but I can't install FRETBursts, and am getting the same module not found error. Am I doing something really silly? Or could this be a bug?

tritemio commented 5 years ago

Docs to install FRETBursts from sources are here:

https://fretbursts.readthedocs.io/en/latest/installation.html#install-latest-development-version

I think you are trying to install FRETBursts in development mode. Make sure you have cython installed before installing FRETBursts from sources. (EDIT: cython is needed to compile the extensions for burst search and other low-level routines).

You may need to nuke Anaconda once every few months at most, but it is not something you should need to do on a regular basis. Maybe you are doing something that creates conflicts, I don't know, something related to conda-forge. I suggest to keep track of all the commands you run so you can eventually nail down the problem.

I do install only jupyter in the base environment, everything else goes to separated environments. In this way it's much harder to hose your base environment requiring a full reinstall. At most, you reinstall a single environment. For each env you also need to installa akernel so that you can use it from jupyter. See this for details:

https://github.com/multispot-software/server-docs/blob/master/howto-add-environments.md

except for the fist command (su conda-admin) which is specific of that setup, the rest should work on any anaconda installation (with no need to use su or sudo).

mayeshh commented 5 years ago

Yes, I am trying to install an editable version of FRETBursts - not the development version - forked from OpenSMFS and cloned with: git clone https://github.com/OpenSMFS/FRETBursts.git. When I try to run pip install -e . in the command line, it causes an error:

Obtaining file:///Users/maya/FRETBursts
Requirement already satisfied: numpy in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (1.15.4)
Requirement already satisfied: scipy in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (1.1.0)
Requirement already satisfied: matplotlib in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (3.0.2)
Requirement already satisfied: lmfit in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (0.9.12)
Requirement already satisfied: seaborn in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (0.9.0)
Collecting phconvert (from fretbursts==0.7+9.g1685418)
Requirement already satisfied: future in /Users/maya/anaconda3/lib/python3.7/site-packages (from fretbursts==0.7+9.g1685418) (0.17.1)
Requirement already satisfied: cycler>=0.10 in /Users/maya/anaconda3/lib/python3.7/site-packages (from matplotlib->fretbursts==0.7+9.g1685418) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /Users/maya/anaconda3/lib/python3.7/site-packages (from matplotlib->fretbursts==0.7+9.g1685418) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/maya/anaconda3/lib/python3.7/site-packages (from matplotlib->fretbursts==0.7+9.g1685418) (2.3.0)
Requirement already satisfied: python-dateutil>=2.1 in /Users/maya/anaconda3/lib/python3.7/site-packages (from matplotlib->fretbursts==0.7+9.g1685418) (2.7.5)
Requirement already satisfied: uncertainties>=3.0 in /Users/maya/anaconda3/lib/python3.7/site-packages (from lmfit->fretbursts==0.7+9.g1685418) (3.0.3)
Requirement already satisfied: asteval>=0.9.12 in /Users/maya/anaconda3/lib/python3.7/site-packages (from lmfit->fretbursts==0.7+9.g1685418) (0.9.13)
Requirement already satisfied: six>1.10 in /Users/maya/anaconda3/lib/python3.7/site-packages (from lmfit->fretbursts==0.7+9.g1685418) (1.12.0)
Requirement already satisfied: pandas>=0.15.2 in /Users/maya/anaconda3/lib/python3.7/site-packages (from seaborn->fretbursts==0.7+9.g1685418) (0.23.4)
Requirement already satisfied: tables in /Users/maya/anaconda3/lib/python3.7/site-packages (from phconvert->fretbursts==0.7+9.g1685418) (3.4.4)
Requirement already satisfied: setuptools in /Users/maya/anaconda3/lib/python3.7/site-packages (from phconvert->fretbursts==0.7+9.g1685418) (40.6.3)
Requirement already satisfied: pytz>=2011k in /Users/maya/anaconda3/lib/python3.7/site-packages (from pandas>=0.15.2->seaborn->fretbursts==0.7+9.g1685418) (2018.7)
Requirement already satisfied: numexpr>=2.5.2 in /Users/maya/anaconda3/lib/python3.7/site-packages (from tables->phconvert->fretbursts==0.7+9.g1685418) (2.6.8)
Installing collected packages: phconvert, fretbursts
  Running setup.py develop for fretbursts
    Complete output from command /Users/maya/anaconda3/bin/python -c "import setuptools, tokenize;__file__='/Users/maya/FRETBursts/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    Warning: 'platforms' should be a list, got type 'tuple'
    running develop
    running egg_info
    writing fretbursts.egg-info/PKG-INFO
    writing dependency_links to fretbursts.egg-info/dependency_links.txt
    writing requirements to fretbursts.egg-info/requires.txt
    writing top-level names to fretbursts.egg-info/top_level.txt
    reading manifest file 'fretbursts.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'fretbursts.egg-info/SOURCES.txt'
    running build_ext
    cythoning fretbursts/phtools/burstsearch_c.pyx to fretbursts/phtools/burstsearch_c.c
    building 'burstsearch_c' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/fretbursts
    creating build/temp.macosx-10.7-x86_64-3.7/fretbursts/phtools
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/maya/anaconda3/include -arch x86_64 -I/Users/maya/anaconda3/include -arch x86_64 -I/Users/maya/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/Users/maya/anaconda3/include/python3.7m -I/Users/maya/anaconda3/include/python3.7m -c fretbursts/phtools/burstsearch_c.c -o build/temp.macosx-10.7-x86_64-3.7/fretbursts/phtools/burstsearch_c.o
    In file included from fretbursts/phtools/burstsearch_c.c:4:
    In file included from /Users/maya/anaconda3/include/python3.7m/Python.h:34:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:66:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/wait.h:110:
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
            uint64_t ri_user_time;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
            uint64_t ri_system_time;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
            uint64_t ri_pkg_idle_wkups;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
            uint64_t ri_interrupt_wkups;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
            uint64_t ri_pageins;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
            uint64_t ri_wired_size;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
            uint64_t ri_resident_size;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
            uint64_t ri_phys_footprint;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
            uint64_t ri_proc_start_abstime;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:206:2: error: unknown type name 'uint64_t'
            uint64_t ri_proc_exit_abstime;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:211:2: error: unknown type name 'uint64_t'
            uint64_t ri_user_time;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:212:2: error: unknown type name 'uint64_t'
            uint64_t ri_system_time;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:213:2: error: unknown type name 'uint64_t'
            uint64_t ri_pkg_idle_wkups;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t'
            uint64_t ri_interrupt_wkups;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:215:2: error: unknown type name 'uint64_t'
            uint64_t ri_pageins;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
            uint64_t ri_wired_size;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:217:2: error: unknown type name 'uint64_t'
            uint64_t ri_resident_size;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:218:2: error: unknown type name 'uint64_t'
            uint64_t ri_phys_footprint;
            ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/resource.h:219:2: error: unknown type name 'uint64_t'
            uint64_t ri_proc_start_abstime;
            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    /Users/maya/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Users/maya/FRETBursts/fretbursts/phtools/burstsearch_c.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    error: command 'gcc' failed with exit status 1`

    ----------------------------------------
`Command "/Users/maya/anaconda3/bin/python -c "import setuptools, tokenize;__file__='/Users/maya/FRETBursts/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1 in /Users/maya/FRETBursts/

If I ignore the error and install the stand-alone FRETBursts environment, the fretbursts import error is fixed. The pip install -e . error is the termnial is also fixed.

When I tried to run pip install -e . twice, I now get the original import error for fretbursts.

If I don't run the pip install -e . command everything seems to be fine. So, this is definitely the source of the problem, but I don't understand it.

tritemio commented 5 years ago

Ok. This is an error during compiling the cython extensions. Googling it, it may be related to a bad interaction between the upgrading to high sierra and brew installation:

So, the question is, did you upgraded to high sierra? Do you have brew installed?

mayeshh commented 5 years ago

I also saw this when I googled it, but I thought it couldn't be the problem because High Sierra is really old, and anyway I am using Mojave 10.14.3

I do have brew installed. I will delete it and see if the issue persists.

tritemio commented 5 years ago

@mayeshh did you solve the issue? Was it somehow related to brew?

mayeshh commented 5 years ago

I have not solved it yet (working frantically to finish the methods paper with X). I will get back to this as soon as it's submitted.

mayeshh commented 5 years ago

Ok, so I had a moment to check if removing brew solved my problem trying to install the stable version FRETBursts. However, there is no difference - I am still getting an error when I try to run pip install -e .

tritemio commented 5 years ago

@mayeshh closing it, feel free to reopen if you still have the issue.

Mattyboi123 commented 3 years ago

Im having this same issue. can someone post the module in question 'phrates_c' . Is it the file with the .c or .pyx extension or should it be .py? is it to do with python 3.8?