maweigert / spimagine

GPU accelerated volume rendering / processing in Python
BSD 3-Clause "New" or "Revised" License
117 stars 17 forks source link

conda install on OSX: `spimagine` can't be imported in python #27

Closed david-hoffman closed 6 years ago

david-hoffman commented 6 years ago

I've followed the instructions to install spimagine via conda on OSX. The install finished without error and I can launch the spimagine standalone program. But I can't import it into python:

(spimenv) Davids-MBP:notebooks david$ conda list spi*
# packages in environment at /Users/david/anaconda3/envs/spimenv:
#
spimagine                 dev.0.2.2       py36_g0a3d847_0    talley
(spimenv) Davids-MBP:notebooks david$ spimagine
WARNING:gputools.config.myconfigparser | [Errno 2] No such file or directory: '/Users/david/.gputools'
[Errno 2] No such file or directory: '/Users/david/.spimagine'
/Users/david/anaconda3/envs/spimenv/lib/python3.6/site-packages/pyopencl/cffi_cl.py:1502: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
  "to see more.", CompilerWarning)
(spimenv) Davids-MBP:notebooks david$ ipython
Python 3.6.3 |Anaconda custom (64-bit)| (default, Nov  8 2017, 18:10:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import spimagine
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-df3e3472a16f> in <module>()
----> 1 import spimagine

ModuleNotFoundError: No module named 'spimagine'

Any thoughts on what might be going wrong? Does a folder need to be added to the PYTHONPATH variable?

maweigert commented 6 years ago

Thanks for reporting!

I'm still using pip for package management (where I never saw that problem), so I'll have to look into that.

@tlambert03: any idea what could be the issue?

tlambert03 commented 6 years ago

hi David, causing trouble again I see? :)

I've sometimes seen this issue (in general in conda, not specific to spimagine) if ipython is not in the environment (spimenv in this case). It may be using your root env ipython, and not finding the packages in ~/anaconda3/envs/spimenv... in your spimenv command prompt, try: $ which ipython
and if the output is /Users/david/anaconda3/bin/ipython that's probably the issue... another way to confirm, try this at the command prompt: $ python -c 'import spimagine; print(spimagine.__file__)' if that works but ipython doesn't, then it's definitely ipython using a different PYTHONPATH

in any case, try conda install ipython in your spimenv environment, then source activate spimenv again, then try running ipython and importing.

david-hoffman commented 6 years ago

Yup @tlambert03 that fixed it!