Mac OS 10.11.6
Procedure:
(venv) [logand05@AMRL2RK0CSFVH8:~/CellProfiler_source_pip/CellProfiler]$ python ./CellProfiler.py
Traceback (most recent call last):
File "./CellProfiler.py", line 4, in <module>
cellprofiler.__main__.main()
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/__main__.py", line 110, in main
cellprofiler.utilities.cpjvm.cp_start_vm()
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/utilities/cpjvm.py", line 95, in cp_start_vm
heap_size = str(cellprofiler.preferences.get_jvm_heap_mb()) + "m"
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 1396, in get_jvm_heap_mb
if config_exists(JVM_HEAP_MB):
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 237, in config_exists
if not get_config().Exists(key):
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 111, in get_config
import wx
ImportError: No module named wx
No problem, I think, then I do pip install wx which completes fine.
But then CP has the following error which I cannot solve:
(venv) [logand05@AMRL2RK0CSFVH8:~/CellProfiler_source_pip/CellProfiler]$ python ./CellProfiler.py
Traceback (most recent call last):
File "./CellProfiler.py", line 4, in <module>
cellprofiler.__main__.main()
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/__main__.py", line 110, in main
cellprofiler.utilities.cpjvm.cp_start_vm()
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/utilities/cpjvm.py", line 95, in cp_start_vm
heap_size = str(cellprofiler.preferences.get_jvm_heap_mb()) + "m"
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 1396, in get_jvm_heap_mb
if config_exists(JVM_HEAP_MB):
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 237, in config_exists
if not get_config().Exists(key):
File "/Users/logand05/CellProfiler_source_pip/CellProfiler/cellprofiler/preferences.py", line 119, in get_config
wx.CONFIG_USE_LOCAL_FILE))
AttributeError: 'module' object has no attribute 'CONFIG_USE_LOCAL_FILE'
Thoughts on how to solve?
wx is version 3.0.3
$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.__version__
'3.0.3'
I tried the stable version (git checkout stable) but I get the same error.
I am encountering the exact same error:
git clone https://github.com/CellProfiler/CellProfiler
cd cellprofiler
pip2 install --editable .
I tried both the master branch as well as the stable branch. Both attempts result in the same error.
git checkout remotes/origin/stable
pip2 uninstall cellprofiler
pip2 install --editable .
$ cellprofiler
Traceback (most recent call last):
File "/usr/local/bin/cellprofiler", line 9, in <module>
load_entry_point('CellProfiler', 'console_scripts', 'cellprofiler')()
File "/Users/davids/src/cellprofiler/cellprofiler/__main__.py", line 176, in main
cp_start_vm()
File "/Users/davids/src/cellprofiler/cellprofiler/utilities/cpjvm.py", line 153, in cp_start_vm
class_path = get_jars()
File "/Users/davids/src/cellprofiler/cellprofiler/utilities/cpjvm.py", line 73, in get_jars
plugin_directory = cpprefs.get_ij_plugin_directory()
File "/Users/davids/src/cellprofiler/cellprofiler/preferences.py", line 832, in get_ij_plugin_directory
if config_exists(IJ_PLUGIN_DIRECTORY):
File "/Users/davids/src/cellprofiler/cellprofiler/preferences.py", line 221, in config_exists
if not get_config().Exists(key):
File "/Users/davids/src/cellprofiler/cellprofiler/preferences.py", line 109, in get_config
wx.Config.Set(wx.Config('CellProfiler','BroadInstitute','CellProfilerLocal.cfg','CellProfilerGlobal.cfg',wx.CONFIG_USE_LOCAL_FILE))
AttributeError: 'module' object has no attribute 'CONFIG_USE_LOCAL_FILE'
$ python2
Python 2.7.11 (default, Apr 6 2016, 11:25:30)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.__version__
'3.0.3'
It turns that pip does not install wx properly, nor does it offer proper uninstallation.
I had to remove wx and related packages manually from /usr/local/lib/python2.7/site-packages.
Then, I installed wxpython using brew on a Mac. On Linux, you should probably use your distribution's package manager to install wxpython instead of using pip.
brew install wxpython
This will install both wxwidgets (wxmac) and the python binding wxpython.
Other requirements _not_ mentioned in the README:
vigra
mysql (brew install mysql)
Thanks @djhshih, I should've amended my comments about using pip to install wx (which I learned later). But did it fix your CONFIG_USE_LOCAL_FILE error? It didn't for me, though I may not have cleaned out my site-packages, so thanks for the tip.
@djhshih vigra is no longer a dependency.
@dlogan You have to clean out your site-packages, otherwise, the wrong module will be loaded. Clearing wx* from site-packages and Installing wxpython with brew solved the error for me.
@0x00b1 I see vigra import errors when I tried to run cellprofiler compiled from the stable branch. I didn't test to see whether those errors prevented the program from running (like the wx.CONFIG_USE_LOCAL_FILE error did). It's good to know that it is no longer a dependency, because it was a bit of a pain to install.
I still couldn't get this method to work, possibly because I had installed Anaconda which clobbers lots of python-y things. And I couldn't get anything but wx 3.0 installed via brew.
Anyway, for a non-software engineer, this Conda method that I just found worked like a charm! https://github.com/CellProfiler/CellProfiler/wiki/Conda-Installation
Thanks @karhohs !
I'll close this, because the 'pip' issue may have been due to my configuration.
Any new information on this, or are you still working with the Conda method?
I'm trying to install cellprofiler from PyPi with
pip2 install --pre --user cellprofiler
However since I am on Ubuntu 14.04 python2.7 is not new enough:
ImportError: Tornado requires an up-to-date SSL module. This means Python 2.7.9+ or 3.4+ (although some distributions have backported the necessary changes to older versions).
So I decided to go the miniconda way, then cellprofiler installs fine, but I get the dreaded wx error:
ImportError: No module named wx
@burgerga I haven't tried in months, but pretty sure I used the conda method last successfully (and not pip). As long as I followed this: https://github.com/CellProfiler/CellProfiler/wiki/Conda-Installation and paid attention to the wxpython version, it worked. Things may have changed in the meantime :/
Most helpful comment
@dlogan You have to clean out your site-packages, otherwise, the wrong module will be loaded. Clearing
wx*from site-packages and Installingwxpythonwithbrewsolved the error for me.@0x00b1 I see
vigraimport errors when I tried to runcellprofilercompiled from the stable branch. I didn't test to see whether those errors prevented the program from running (like thewx.CONFIG_USE_LOCAL_FILEerror did). It's good to know that it is no longer a dependency, because it was a bit of a pain to install.