ulmo-dev / ulmo

clean, simple and fast access to public hydrology and climatology data.
http://ulmo.readthedocs.org
Other
169 stars 63 forks source link

suds-jurko and setuptools 58 conflict with pip install #212

Closed emiliom closed 8 months ago

emiliom commented 2 years ago

From https://github.com/snowex-hackweek/docker-image/pull/29#issuecomment-926816539:

running into an issue with ulmo dependency suds-jurko andersinno/suds-jurko#6 , workaround seems to be pinning setuptools<58

KehanGit commented 2 years ago

Any updates on this conflict? I am running into the same problem.

emiliom commented 2 years ago

From @KehanGit , from another exchange:

I am trying to use it for the SNOTEL data analysis and installed in successfully but when I tried to import the package, it has an error as shown below.

image

@KehanGit could you specify how you installed ulmo, what version of ulmo was installed, and what suds library (I assume it was suds-jurko) and version was installed?

For reference, #189 is somewhat related to this issue.

emiliom commented 2 years ago

I installed ulmo just now, like this:

mamba create -n ulmo_test -c conda-forge python==3.8 ulmo ipykernel

Then I was able to import ulmo without problems.

FYI, I'm on Ubuntu Linux; I pinned Python to 3.8 b/c that's what I see in your error report; I added ipykernel just to be able to test in IPython; and I used mamba rather than conda to get to a successful conda environment more quickly.

KehanGit commented 2 years ago

Hi Emilio,

Thanks a lot for your reply. To install ulmo, I used 'pip install ulmo' on a python virtual environment on Ubuntu Linux. I have installed ipykernel on this environment.

Do you have any idea what may cause the errors I had? Thanks!

Best regards, Kehan

On Sun, May 15, 2022 at 2:58 PM Emilio Mayorga @.***> wrote:

I installed ulmo just now, like this:

mamba create -n ulmo_test -c conda-forge python==3.8 ulmo ipykernel

Then I was able to import ulmo without problems.

FYI, I'm on Ubuntu Linux; I pinned Python to 3.8 b/c that's what I see in your error report; I added ipykernel just to be able to test in IPython; and I used mamba rather than conda to get to a successful conda environment more quickly.

— Reply to this email directly, view it on GitHub https://github.com/ulmo-dev/ulmo/issues/212#issuecomment-1127056646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVXHDLQINYCF6W2X6G7AILVKFXQHANCNFSM5EZZOGOA . You are receiving this because you were mentioned.Message ID: @.***>

emiliom commented 2 years ago

Thanks for the information. I've created a conda environment where I then installed ulmo via pip install ulmo. I then ran into an error when trying to do import ulmo, though the error was different from yours.

What version of ulmo was installed? I don't remember how to find the version in an environment that's not conda, if import ulmo fails! Can someone in your group help you get at that? What I found with my test with pip install is that it ended up falling back to a really, really old version of ulmo, 0.5.0! The initial errors start during pip install while installing suds-jurko. It ends up failing to install suds-jurko altogether and instead installs its much older predecessor, suds.

Do you use conda? From what I can tell, that would solve the problem and let you use ulmo w/o problems. That doesn't address the real problem with installation via pip install; I'd like to look into it later.

For future reference, here's the first error reported during pip install ulmo on the fist attempt to install suds-jurko:

Collecting suds-jurko
  Downloading suds-jurko-0.6.zip (255 kB)
     |████████████████████████████████| 255 kB 35.2 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/mayorga/miniconda3/envs/ulmo_pip/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ka62o_x0/suds-jurko_c386975ba86b41c6b0dc93e03c4d7a56/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ka62o_x0/suds-jurko_c386975ba86b41c6b0dc93e03c4d7a56/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9kizjuhl
         cwd: /tmp/pip-install-ka62o_x0/suds-jurko_c386975ba86b41c6b0dc93e03c4d7a56/
    Complete output (1 lines):
    error in suds-jurko setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/d0/88/f3bed9b494e0dae26bd55e5f3d527b8244208125024727267e8109956a11/suds-jurko-0.6.zip#sha256=1cb7252cb13018fc32887c3a834ed7c6648a5b5c4c159be5806da2e1785399e8 (from https://pypi.org/simple/suds-jurko/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The installer keeps trying with older versions of suds-jurko, then gives up and tries older and older versions of ulmo until it finds one that can install using the predecessor of suds-jurko, suds.

emiliom commented 2 years ago

I went back and tried the recommendation at the start of this issue: pinning setuptools to <58 when installing ulmo via pip install. That worked! import ulmo no longer leads to an error.

jayqi commented 8 months ago

I've got a simple workaround for the setuptools + suds-jurko issue that folks may find helpful.

What I've done is pre-build a wheel (using the older version of setuptools) and made that available on GitHub: https://github.com/drivendataorg/suds-jurko-wheel

You can then either install the wheel distributed on that repository first or side-by-side with ulmo and it will install with no problems.

For example:

pip install ulmo "suds-jurko @ https://github.com/drivendataorg/suds-jurko-wheel/releases/download/v0.6/suds_jurko-0.6-py3-none-any.whl"

or in a requirements.txt

suds-jurko @ https://github.com/drivendataorg/suds-jurko-wheel/releases/download/v0.6/suds_jurko-0.6-py3-none-any.whl
ulmo

The wheel is redistributing suds-jurko without modification. The build process happens in GitHub CI transparently, and the build script is here.

This way you don't need to fuss with setuptools or don't need to be forced to use conda.

emiliom commented 8 months ago

Thank you @jayqi !! To make it simpler for future users who run into this problem, I'll close this issue and leave #215 open (it has a more unambiguous title than this one); that's the other issue where you commented on your solution.