Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation via pip into conda environment on Windows #151

Open
PTRRupprecht opened this issue Apr 29, 2021 · 7 comments
Open

Installation via pip into conda environment on Windows #151

PTRRupprecht opened this issue Apr 29, 2021 · 7 comments

Comments

@PTRRupprecht
Copy link

I noticed a problem when installing FISSA with "pip install fissa" from an Anaconda environment under Windows. The installation seems to work smoothly, but once I "import fissa" in Python, I get an error message related to the package "geos" when loading the "shapely" package. I got this on two different Windows computers, so I thought it might also affect others.

The problem could be solved by following the suggestions indicated on this Stack overflow question: https://stackoverflow.com/questions/44398265/install-shapely-oserror-winerror-126-the-specified-module-could-not-be-found

I simply used "conda install -c conda-forge shapely", and it worked afterwards.

@swkeemink
Copy link
Member

Glad you worked it out, and thanks for posting it here, it might help other users!

We did gave specific anaconda instructions that covered this: https://github.com/rochefort-lab/fissa#anaconda-distribution
But there might be something missing from our standard windows installation instructions. @scottclowe didn't we used to have instructions for some weird shapely wheel (from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely). Was that no longer necessary on non-anaconda installations?

@PTRRupprecht
Copy link
Author

PTRRupprecht commented Jun 2, 2021

I see ... sorry for asking a question that was already covered by your docs. It was not clear to me that an installation in an Anaconda environment needed to be done using the specific way described in your Anaconda-specific installation instructions, and that "pip install fissa" would work under a "Official Python distribution", but not under the "Anaconda distribution". Probably I'm not the only one who has forgotten that there is a difference between the two distributions ...

@scottclowe
Copy link
Member

@swkeemink Indeed, we deleted the cumbersome installation instructions which involved manually downloading shapely from that site because they are no longer necessary. At some point shapely started adding wheels which worked on Windows to their PyPI distribution.

We run the unit test suite on Windows with a PyPI-only build (no conda) https://github.com/rochefort-lab/fissa/blob/master/.appveyor.yml
It is tested on Python 3.5 and 3.8 on each push/PR and that builds without issue (though the job has not been run for a while now, so it is possible there is an issue caused by changes in our dependencies).

@PTRRupprecht Could you let us know what version of Python you are using? It would also be helpful to see the error traceback so we can see what was going on with this error. Whilst you can use a conda build to run fissa, you do not need to. Using either the "official distribution" or the "anaconda distribution" installation method should run fine! Anything which correctly installs with pip should also install with pip while you are inside an anaconda environment.

@swkeemink
Copy link
Member

I see ... sorry for asking a question that was already covered by your docs. It was not clear to me that an installation in an Anaconda environment needed to be done using the specific way described in your Anaconda-specific installation instructions, and that "pip install fissa" would work under a "Official Python distribution", but not under the "Anaconda distribution". Probably I'm not the only one who has forgotten that there is a difference between the two distributions ...

No problem at all, and you're right that currently it's not as clear as it could be as it is currently laid out in our readme. @scottclowe I would actually suggest we put the anaconda instructions on top since that is the majority of the use-cases these days.

@swkeemink
Copy link
Member

@swkeemink Indeed, we deleted the cumbersome installation instructions which involved manually downloading shapely from that site because they are no longer necessary. At some point shapely started adding wheels which worked on Windows to their PyPI distribution.

We run the unit test suite on Windows with a PyPI-only build (no conda) https://github.com/rochefort-lab/fissa/blob/master/.appveyor.yml
It is tested on Python 3.5 and 3.8 on each push/PR and that builds without issue (though the job has not been run for a while now, so it is possible there is an issue caused by changes in our dependencies).

@PTRRupprecht Could you let us know what version of Python you are using? It would also be helpful to see the error traceback so we can see what was going on with this error. Whilst you can use a conda build to run fissa, you do not need to. Using either the "official distribution" or the "anaconda distribution" installation method should run fine! Anything which correctly installs with pip should also install with pip while you are inside an anaconda environment.

@scottclowe I think the issue might be that the default pip install (without conda installing the dependencies) works fine under a standard python installation, but not an Anaconda installation. Or indeed a dependency has stopped working. We might find out when I push a fix for #150 this week ;).

@PTRRupprecht
Copy link
Author

PTRRupprecht commented Jun 2, 2021

@PTRRupprecht Could you let us know what version of Python you are using? It would also be helpful to see the error traceback so we can see what was going on with this error. Whilst you can use a conda build to run fissa, you do not need to. Using either the "official distribution" or the "anaconda distribution" installation method should run fine! Anything which correctly installs with pip should also install with pip while you are inside an anaconda environment.

I managed to reproduce the error (FISSA is however working for me if I install differently). On Windows, in a newly generate "fissa" environment:

(base) C:\>conda activate fissa

(fissa) C:\>pip install fissa
Collecting fissa
  Downloading fissa-0.7.2-py2.py3-none-any.whl (44 kB)
 [....]
Collecting shapely>=1.5.17
  Downloading Shapely-1.7.1-cp39-cp39-win_amd64.whl (978 kB)
[....]
Installing collected packages: six, python-dateutil, pyparsing, Pillow, numpy, kiwisolver, decorator, cycler, tifffile, threadpoolctl, scipy, PyWavelets, networkx, matplotlib, joblib, imageio, shapely, scikit-learn, scikit-image, read-roi, future, fissa
Successfully installed Pillow-8.2.0 PyWavelets-1.1.1 cycler-0.10.0 decorator-4.4.2 fissa-0.7.2 future-0.18.2 imageio-2.9.0 joblib-1.0.1 kiwisolver-1.3.1 matplotlib-3.4.2 networkx-2.5.1 numpy-1.20.3 pyparsing-2.4.7 python-dateutil-2.8.1 read-roi-1.6.0 scikit-image-0.18.1 scikit-learn-0.24.2 scipy-1.6.3 shapely-1.7.1 six-1.16.0 threadpoolctl-2.1.0 tifffile-2021.4.8

(fissa) C:\>python
Python 3.9.5 (default, May 18 2021, 14:42:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fissa
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda3\envs\fissa\lib\site-packages\fissa\__init__.py", line 3, in <module>
    from .core import Experiment
  File "C:\Anaconda3\envs\fissa\lib\site-packages\fissa\core.py", line 20, in <module>
    from . import datahandler
  File "C:\Anaconda3\envs\fissa\lib\site-packages\fissa\datahandler.py", line 20, in <module>
    from . import roitools
  File "C:\Anaconda3\envs\fissa\lib\site-packages\fissa\roitools.py", line 15, in <module>
    from .ROI import poly2mask
  File "C:\Anaconda3\envs\fissa\lib\site-packages\fissa\ROI.py", line 30, in <module>
    from shapely.geometry import MultiPolygon, Polygon, Point
  File "C:\Anaconda3\envs\fissa\lib\site-packages\shapely\geometry\__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "C:\Anaconda3\envs\fissa\lib\site-packages\shapely\geometry\base.py", line 19, in <module>
    from shapely.coords import CoordinateSequence
  File "C:\Anaconda3\envs\fissa\lib\site-packages\shapely\coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "C:\Anaconda3\envs\fissa\lib\site-packages\shapely\geos.py", line 149, in <module>
    _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
  File "C:\Anaconda3\envs\fissa\lib\ctypes\__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Anaconda3\envs\fissa\Library\bin\geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

@scottclowe
Copy link
Member

Thanks for the details! We'll see if we can reproduce the issue, then either resolve it or if not then clarify the installation instructions so others don't run into the same problem.

@scottclowe scottclowe changed the title Installation via pip on Windows Installation via pip into conda environment on Windows Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants