mobiusklein / ms_deisotope

A library for deisotoping and charge state deconvolution of complex mass spectra
https://mobiusklein.github.io/ms_deisotope
Apache License 2.0
33 stars 14 forks source link

erron on import #12

Closed infusini closed 5 years ago

infusini commented 5 years ago

Hi @mobiusklein,

Sorry to bother you with this, but I'm having trouble installing the repo with the latest releases.

Below is the error:

(ms_deiso_new) [ms_deisotope-0.0.8]$ python -c "import ms_deisotope"                                                                                                                              │
No module named 'ms_deisotope._c.averagine' averagine                                                                                                                                                                 │
No module named 'ms_deisotope._c.scoring'                                                                                                                                                                             │
No module named 'ms_deisotope._c.deconvoluter_base'                                                                                                                                                                   │
No module named 'ms_deisotope._c.deconvoluter_base'                                                                                                                                                                   │
No module named 'ms_deisotope._c.deconvoluter_base'

this is from a fresh install of python (anaconda 2019.03) on CentOS 7. All the

Any insights/ideas would be greatly appreciated.

Cheers

mobiusklein commented 5 years ago

Could you post any messages you get during installation? It looks like the C extensions weren't compiled.

Are you installing ms_peak_picker from source as well?

infusini commented 5 years ago

Hi, thanks for your reply!

Yes, I have installed ms_peak_picker from source first, and brainpy just before installing ms_deisotope. I have also tried with the latest releases (rather than cloning the repos, but the result was the same.

The output is here: https://gist.github.com/infusini/836118414f3b52f37262ccb91deeed2f

mobiusklein commented 5 years ago

Hmm. I wasn't testing on Py3.7, but I've just updated my Travis config and it seems to build fine there. What kind of environment are you running this on? An AWS hosted instance?

Are you running Python directly from the source directory for ms_deisotope?

infusini commented 5 years ago

I have tried on both an Ubuntu instance on AWS, and a CentOS here on our internal VMs

Yes, I did run python from within the source directory of ms_deisotope (sorry). It didn't occur to me to try from somewhere else to check... and, of course, it works perfectly fine now. Thanks for your help :(

buntu@ip-172-31-24-45:~/ms_deisotope$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ms_deisotope
No module named 'ms_deisotope._c.averagine' averagine
No module named 'ms_deisotope._c.scoring'
No module named 'ms_deisotope._c.deconvoluter_base'
No module named 'ms_deisotope._c.deconvoluter_base'
No module named 'ms_deisotope._c.deconvoluter_base'
>>>
ubuntu@ip-172-31-24-45:~/ms_deisotope$ cd ..
ubuntu@ip-172-31-24-45:~$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ms_deisotope
>>>
mobiusklein commented 5 years ago

Glad it was resolved. I've spent days of investigation to only find that was the culprit. When run from the source directory, Python tries to import from the local directory first, where it finds the source (without the compiled C extensions), and never looks in site-packages.

If you find yourself needing to do that, or to tweak things, you can install it with python setup.py develop or pip install -e, which will compile the C extensions and then place the .so files alongside the source code. These "editable" installations have some downsides for package metadata introspection, but I rarely have an issue with that.