respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

Create `setup.py` for `pip install HSPsquared` #55

Closed timcera closed 2 years ago

timcera commented 2 years ago

I know everybody and their uncle want me to use conda, but on Linux conda will overlay libraries that it installs in-place of system libraries. That isn't the way that I want things handled. I use package management for the system libraries (not conda) and I use pip for python and they don't overlap.

Pip and conda can coexist, because all that pip needs is a setup.py. I had contributed a setup.py to HSPsquared some time ago and it was deleted. Would a resurrected setup.py be accepted as a pull request?

Another advantage to having a setup.py is that it is also used to upload packages to the Python Package Index (https://pypi.org/) where HSPsquared could be available to anyone in the world by using "pip install HSPsquared".

Kind regards, Tim

mishranurag commented 2 years ago

I love the idea of "pip install HSPsquared" ~A


Anurag

On Thu, Jul 22, 2021 at 12:53 PM Tim Cera @.***> wrote:

I know everybody and their uncle want me to use conda, but on Linux conda will overlay libraries that it installs in-place of system libraries. That isn't the way that I want things handled. I use package management for the system libraries (not conda) and I use pip for python and they don't overlap.

Pip and conda can coexist, because all that pip needs is a setup.py. I had contributed a setup.py to HSPsquared some time ago and it was deleted. Would a resurrected setup.py be accepted as a pull request?

Another advantage to having a setup.py is that it is also used to upload packages to the Python Package Index (https://pypi.org/) where HSPsquared could be available to anyone in the world by using "pip install HSPsquared".

Kind regards, Tim

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/respec/HSPsquared/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTCNZ4J3AIFSTRHCLJ44H3TZBZNJANCNFSM5A2VSH4A .

aufdenkampe commented 2 years ago

@timcera, thanks for offering to pull together an updated setup.py! If you issued a pull request to the develop branch, that would be a great contribution.

I had suggested we delete the old setup.py because it was very outdated and I wasn't as familiar with the process of creating a pip installable package. I agree that it would be nice to have that in parallel to the conda install approach.

I am quite confused, however by your statement that:

... but on Linux conda will overlay libraries that it installs in-place of system libraries.

None of us want that, which is one of the many reasons why Conda is so powerful -- it installs all packages independently of the operating system Python in separate virtual environments that can be spun up easily and independently of one another. I do this all the time on my Mac (which is Unix-based, with an integrated system-level Python). I have not experienced what you described and I'm somewhat skeptical that it is the default behavior of conda on linux.

Regarless, having coexisting pip and conda approaches to installing this repo, along with all dependencies, would be very valuable. Thanks for offering.

timcera commented 2 years ago

Created a conda environment, used conda to install some stuff into it including a python package that had an SSL library as a dependency which conda also installed for me. Activate the new environment and my command line "ssh" stopped working because it was finding the conda installed SSL library and the versions didn't match. Conda adjusts the LD_LIBRARY_PATH when activating an environment in order to find the dynamic libraries that it has installed. I believe this is the same as your Mac. Looking back on this, perhaps I could have fixed with a careful reordering of paths in LD_LIBRARY_PATH environment variable, but near the same time I came to the conclusion that "pip" did everything I need and didn't understand why I was struggling with conda and deleted all the conda environments and all the conda build scripts from anaconda.org that I had painfully created for all of my projects.

There was another issue where the conda supplied GDAL/OGR libraries didn't include support for geoTiff, which I needed. So I created my own conda build script to build GDAL/OGR with geoTiff support and put it up on anaconda.org. I wasn't the only one: https://anaconda.org/search?q=gdal, but I had no idea what these other people had done. I see the issue of everyone rolling their own as a big problem because it discourages actually fixing the canonical version and plus who verifies these packages? Most of the time there isn't even a read me. And if the canonical version is fixed, there is no way to deprecate or delete uploaded packages that also contain the fix. On the pip side there is only one "tstoolbox", "tsgettoolbox", ...etc. on pypi.org.

Will start working up a setup.py. I have a good, up to date template in my projects which should easily transfer, but it still might be a couple weeks.

Kind regards, Tim

aufdenkampe commented 2 years ago

We've completed this with:

Thanks @timcera