Psy-Fer / SquiggleKit

SquiggleKit: A toolkit for manipulating nanopore signal data
MIT License
120 stars 23 forks source link

Trouble Installing MLPY #28

Closed defectsnow closed 4 years ago

defectsnow commented 4 years ago

Although not specifically due to Squiggle Kit, I am unable to install mlpy3.5.0

I'm using Python 3.7.3 in a Debian WSL.

Originally when installing it, I would get an error due to gsl directory not found. I used Miniconda3 to install gsl.

Whenever I try to install it, through either pip3, setup.py, or easy_install, I get:

mlpy/gsl/gsl.c: In function ‘__Pyx_GetException’:
mlpy/gsl/gsl.c:4027:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
     tmp_type = tstate->exc_type;
                        ^~~~~~~~

Everything else has been installed, including Homebrew + all of the packages mentioned in the installation section.

Any insight onto your own setup or possible solutions would be very helpful! Thanks

Psy-Fer commented 4 years ago

Hello,

Just to confirm, did you use the following to install mlpy?

pip3 install machine-learning-py

James

Psy-Fer commented 4 years ago

To add some context, someone was very kind in making a package that wraps mlpy for python3.

Just checking that before I go and roll an environment to check 3.7.3

defectsnow commented 4 years ago

Yes, pip3 install machine-learning-py results in the same error as above.

Psy-Fer commented 4 years ago

okay, so i'm working on Ubuntu 18.04, pretty much fresh install, so discovering things I took for granted in my old dev machine that had pretty much everything.

i did a python3 .7 -m venv ./SquiggleKit376 source ./SquiggleKit376/bin/activate

I got the same error as you trying to pip3 install, so started going through from the start

pip install numpy h5py sklearn matplotlib scipy

I then had to do this (Seems to only be for python3.7, not needed on 3.6) sudo apt install libopenblas-dev to make sure pip3 install scrappie would work

Then I tried pip3 install machine-learning-py again, but no luck.

I then tried to install gls using apt, and it threw on version 2.4, but that didn't help. So removed that.

So then I downloaded 1.11 from gnu website, here -> http://mirror.downloadvn.com/gnu/gsl/ tar -zxf tar -zxf gsl-1.12.tar.gz cd gsl-1.12 ./configure make sudo make install

run pip3 install machine-learning-py aaaand NOPE!

So now if I try looking at this manually from the mlpy-3.5.0 download I do a sudo /full/path/to/venv/python setup.py install and I still get gsl issues.

So then I tried setting the gsl libraries.

sudo /home/jamfer/pvenv/SquiggleKit376/bin/python setup.py build_ext --include-dirs=/usr/local/include/gsl --rpath=/usr/local/lib

aaaand nope again...

So I started scratching my head....and tracked down that this seems to be related to cython! https://github.com/cython/cython/issues/1955 https://github.com/pandas-dev/pandas/issues/21785

and many more examples....

So i switched back to python3.6, and everything installs without any issues, all using pip3

So my advice here, would be use python3.6, rather than 3.7, as I think cython is a bit broken, especially for these older packages.

I'm sorry for the inconvenience, I hope using python3.6 is possible for you. I find using this ppa the easiest for various python versions. here an example of installing, and setting up an environment:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.6 python3.6-dev python3.6-pip python3.6-venv

python3.6 -m venv ./SquiggleKit36
source ./SquiggleKit36/bin/activate

Let me know how you get along

defectsnow commented 4 years ago

Alright so I installed Ubuntu 18 WSL and made sure to be using 3.6 so I could use its ppa and simulate your enviornment. I had to do a few extra things to get it to work, as python3.6-pip did not install and I had to:

sudo apt-get install python3-distutils
curl https://bootstrap.pypa.io/get-pip.py | sudo -H python3.6

I also had to sudo apt-get install python3-venv for the env to work.

Everything else installed fine, here is what pip3 list gives me:

cffi (1.13.2)
cycler (0.10.0)
h5py (2.10.0)
joblib (0.14.1)
kiwisolver (1.1.0)
matplotlib (3.1.2)
numpy (1.18.1)
ont-fast5-api (3.0.1)
pip (9.0.1)
pkg-resources (0.0.0)
progressbar33 (2.4)
pycparser (2.19)
pyparsing (2.4.6)
python-dateutil (2.8.1)
scikit-learn (0.22.1)
scipy (1.4.1)
scrappie (1.4.2)
setuptools (39.0.1)
six (1.14.0)
sklearn (0.0)

Unfortantely I still get an error from mlpy. I am unsure if it is a gsl error this time, it seems to originate from gnu? The error:

    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/defectsnow/SquiggleKit36/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1bvnehru/machine-learning-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-xycdyui4-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/defectsnow/SquiggleKit36/include/site/python3.6/machine-learning-py" failed with error code 1 in /tmp/pip-build-1bvnehru/machine-learning-py/
Psy-Fer commented 4 years ago

Looks like a gcc issue, 86_64-linux-gnu-gcc is just the fancy name for gcc in 18.04 what happens when you do gcc --version

or

which gcc ?

defectsnow commented 4 years ago

So, much trial and error led me to solve an error then having more. Luckily, I was able to get it installed.

To do so, in addition to what I had above, I:

sudo apt-get install python3-distutils
sudo apt-get install build-essential
sudo apt-get install libgsl-dev
sudo apt-get install tcl-dev tk-dev python-tk python3-tk

For whatever reason, my pip wheel was also not installed, so ensure that is installed with pip3 install wheel

I also installed Homebrew for WSL. After those, I was able to install mlpy using pip3 install machine-learning-py as suggested in the starting guide.

Thanks a ton for your help, I look forward to using SquiggleKit!

Psy-Fer commented 4 years ago

Ah, i'm great you could get it working. Thanks for putting your solution here.

I'm not sure homebrew is needed unless you are using a mac, as it was just to download gnu tar, as the mac native tar doesn't have the same commands to strip directory structures in tarballs (before multi fast5 was a thing).

defectsnow commented 4 years ago

Ah alright, I was just double checking to make sure I had everything installed correctly on here first before I posted about it again, so I figured it was worth mentioning.

I will probably try and write something a guide about using SquiggleKit on WSL with Ubuntu and Python3.6. I encountered other issues like matplotlib not graphing, and some print functions acting up. Fixed them but requires tinkering.

Psy-Fer commented 4 years ago

Ahh yes, tkinter and all that jazz.

Things that get missed without using a VM or fresh install.