opencobra / memote

memote – the genome-scale metabolic model test suite
https://memote.readthedocs.io/
Apache License 2.0
127 stars 27 forks source link

Python version for memote installation #245

Closed arichelle closed 6 years ago

arichelle commented 7 years ago

Does anyone has succeed installing memote using python 2.7 versions?

I've tried it on Linux and MacOS and for both memote installation required a python 3 version.

If it is the case, it should be announced in the Installation section.

Midnighter commented 7 years ago

Actually, both @ChristianLieven and I have installed memote on Python 2.7. He works with Mac and I with Linux. So what makes you say Python 3 is required?

arichelle commented 7 years ago

Interesting, when I've try to install using the buit-in version of Pyhton available on my mac, memote was not able to import some part of the Jinja2 package (specifically "select_autoescape") and on Linux, I've ask our software technician to hep me install on our server and it took us more than an hour. Finally the technician told me that we have two version of Pyhton available on our server and Memote was trying to use Python 2.7 while it was only running properly using Python 3 versions...

I'm not close enough to these installation aspects to evaluate what was the trouble on my computer and I guess if I'm the only one reporting this trouble, it most probably just me that have mishandle the installation.

Midnighter commented 7 years ago

I am happy to discuss this in more detail on our gitter channel but with the current information I'm afraid I can't help you.

If you use some kind of Python virtual environment (pyvenv, virtualenv, pipenv, conda, etc.) then the installation should really be as easy as pip install memote. Since you say that you're using the built-in Python on your personal Mac, if you don't use a virtual environment to isolate your project there might be permission problems with pip trying to upgrade system packages.

Let me know if you want to chat about it. You can also mention me there with @midnighter just like here.

Midnighter commented 7 years ago

@arichelle So we just noticed that the built-in Python on Mac indeed causes a segmentation fault. Is that what you saw as well? Can you install Python from homebrew or conda for your own laptop? Do you know in some more detail what went wrong on the server? I've not seen any problems on Linux so far (if that is what your server runs).

Midnighter commented 7 years ago

Something else that fixes the problem on Mac is apparently to upgrade Xcode. Simply run xcode-select install.

arichelle commented 7 years ago

OK I will check these tips ASAP and come back to you

arichelle commented 7 years ago

@Midnighter I still have the segmentation fault when I update XCode...

ChristianLieven commented 7 years ago

@phantomas1234 Might want to share his solution, if there has been a solution already?

Midnighter commented 7 years ago

@Midnighter I still have the segmentation fault when I update XCode...

I will defer to @phantomas1234 since he found the solution but I would guess you also have to pip uninstall optlang and pip install optlang. Let's just wait for his comment, though.

phantomas1234 commented 7 years ago

@arichelle do you have gurobi installed by any chance? A dependent package of memote will try to load gurobi (gurobipy specifically) which will lead to a segmentation fault if not the exact version of python is used that gurobi was compiled against (at least that was the problem for me). This is probably an issue of using $PYTHONPATH so that the wrong version of Python will still see gurobipy. Can you check what the output of echo $PYTHONPATH is on your terminal? A solution to this is to not use $PYTHONPATH to install Python packages. Also virtualenv should be used ideally. Of course we're targeting non-Python experts with the memote command line app so we have an interest in making the installation as smooth as possible. If it was indeed gurobipy causing you troubles then we check for this edge case @Midnighter because probably quite a lot of modellers will have gurobi installed. Also some info from your technician on the Linux side of problems would be appreciated.

arichelle commented 7 years ago

echo $PYTHONPATH return an empty space. Note, that even if I use the virtualenv to run memote, I still have a segmentation fault.

Concerning the Linux side, we had trouble with this line "from jinja2 import Environment, PackageLoader, select_autoescape" in "memot/suite/reporting/reports/report.py" and we were not able to import select_autoescape from jinga2 due to some missing library.

phantomas1234 commented 6 years ago

@arichelle what happens if you run python -c "import gurobipy" in your terminal. Also, do python -c "import optlang" and python -c "from swiglpk import glp_version"lead to segmentation faults as well? Thank you for bearing with us.

arichelle commented 6 years ago

Anne$ python -c "import gurobipy" Traceback (most recent call last): File "", line 1, in ImportError: No module named gurobipy

Anne$ python -c "import optlang" Traceback (most recent call last): File "", line 1, in ImportError: No module named optlang

Anne$ python -c "from swiglpk import glp_version" Traceback (most recent call last): File "", line 1, in ImportError: No module named swiglpk

phantomas1234 commented 6 years ago

@arichelle that is very confusing because optlang and swiglpk are dependencies of memote and should have been installed in the process of installing memote. Are you sure memote was installed in this environment? I mean what happens if you run python -c "import memote"? If that is still leading into a seg fault, could you please pip uninstall memote and then pip install memote and then try again python -c "import optlang" (and also python -c "import memote" just to be sure). Otherwise, would you maybe be ok to have a short meeting over skype/google hangouts to get to the root of this? Unfortunately, we can't really debug this without your help.

arichelle commented 6 years ago

OK I got it, my mistake was stupid. I was using the virtualenv to run memote but not to install it, which now seems obvious to me but was not not really clear in the "Getting Started" section of memote.readthedocs.io.

As you want to make it a very easy to use tool, I'd suggest to be more detailed in the installation section. I give you a draft of what I'm thinking about.

Installation Requirements : python and pip properly installed You can check your installed version using

$ python --version
$ pip --version

If you don’t have python and/or pip installed, this Python installation guide can guide you through the process.

Download memote The sources for memote can be downloaded from the Github repo.

You can either clone the public repository: $ git clone https://github.com/opencobra/memote.git

Or download the tarball or zip archive: $ curl -OL https://github.com/opencobra/memote/archive/master.zip

Install memote We highly recommend creating a Python virtualenv for installing memote to avoid some installation trouble.virtualenv is a tool to create isolated Python environments: it creates a folder which contains all the necessary executables to use the packages that a Python project would need.

Install virtualenv via pip: $ pip install virtualenv

Test your installation $ virtualenv --version

Create a virtual environment for installing memote:

$ cd my_project_folder
$ virtualenv my_project

Activate the virtual environment: $ source my_project/bin/activate

Install memote in the virtual environment $pip install memote

Note that you can directly run this last command if you do not want to install memote in a virtual environment.

Using memote After installation, memote can be employed in two different ways: As a benchmarking tool for ad hoc model assessment and as an automated testing suite to aid with the reconstruction of metabolic models.... and after put the different sections describing the use of memote as already done

Midnighter commented 6 years ago

Hey, thank you so much Anne for the more detailed install instructions. I'll include them in the docs! I'll consider this solved then. Feel free to re-open the issue or start a new one if anything comes up.

phantomas1234 commented 6 years ago

Yes thanks @arichelle!

Midnighter commented 6 years ago

Actually I'll leave this open to remind me of merging the description.