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

Conda environment compatability. #1

Closed
emirkmo opened this issue Sep 10, 2021 · 2 comments · Fixed by #2
Closed

Conda environment compatability. #1

emirkmo opened this issue Sep 10, 2021 · 2 comments · Fixed by #2
Assignees
Labels
enhancement New feature or request

Comments

@emirkmo
Copy link

emirkmo commented Sep 10, 2021

Background:

As this seems to be a mix of data science and software development project, there are some things to think about. Conda as a package and python virtual environment manager is ubiquitous in data science, sometimes to the consternation of Python programmers. Conda will just work with traditional (and admittedly janky) setuptools based package requirements. It can also use an environment.yml file specifically for conda, or even just a simple pip requirements file.

Description of the problem:

I went down a rabbit hole chasing down getting poetry to work using my conda based python installation, and setting up poetry inside of a conda based (python) virtual environment. The official docs of poetry recommend a base installation separate of package managers like conda (https://python-poetry.org/docs/#alternative-installation-methods-not-recommended). Documentation is lacking in how poetry interacts with conda virtual environments (python-poetry/poetry#1724). Poetry devs decided to reject even considering conda compatibility and closed the issue (python-poetry/poetry#105). There are some scripts for taking a poetry based pyproject file and converting it to a conda one (https://github.com/dojeda/poetry2conda), however, they are unmaintained, and require individually reviewing packages, knowing whether their Pypi or conda names are used, and editing the pyproject.toml file to point to the correct package manager, source, names, etc, possibly for many dependencies. Poetry also requires a workaround to install a package in editable mode, which is sometimes used for development work.

As a result of this, I spent more than half an hour trying to simply create a virtual environment that I could work on wraeblast with.

Issue:

Wraeblast is difficult to get running for people using conda, without possibly messing up your development environment (as several documented issues on poetry's github page shows). There are issues with poetry's own dependencies bleeding into the virtual environment or even your root/base python environment. This is caused by a lack of providing "the old way" of packaging python software, as existing workflows were configured to work from this (admittedly somewhat flawed) system.

Suggestion:

Provide and maintain either a traditional setup.py, an alternative requirements.txt, or even better, a conda environment.yml file for easily starting to work on wraeblast. It would have taken me about 20 seconds instead of more than half an hour, and especially as you said on reddit, if you want some data scientist type people taking a look at the package, it would make the process of contributing much more accessible for that community.

Conclusion:

Please add a non-poetry way of dependency tracking that works with existing workflows prevalent in other communities, or at least a guide on how to get this running using poetry and the recent PEP suggested pyproject.toml files.

@emirkmo emirkmo changed the title Conda environment compataibility Conda environment compatability. Sep 10, 2021
@darvid darvid added the enhancement New feature or request label Sep 10, 2021
@darvid darvid self-assigned this Sep 11, 2021
@darvid darvid added this to In progress in Data science Sep 11, 2021
@darvid darvid mentioned this issue Sep 11, 2021
@darvid
Copy link
Owner

darvid commented Sep 11, 2021

Thanks for the detailed write-up. I added a environment.yml in #2 with poetry2conda. The workflow will look like:

$ conda env create -f environment.yml
$ conda develop .
$ conda install -c anaconda ipykernel jupyter

I'm not quite sure how to add jupyter/ipykernel as persistent dependencies in the environment.yml without including them in the pyproject.toml, which I'm not sure we want to do (as main deps, it might make sense to add them as dev deps). As you mentioned, adding the current project as a development package requires some hacks, I feel like just documenting conda develop . is cleaner, but I don't have strong opinions.

@darvid darvid closed this as completed in #2 Sep 11, 2021
@darvid darvid moved this from In progress to Done in Data science Sep 11, 2021
@emirkmo
Copy link
Author

emirkmo commented Oct 13, 2021

I'll take a look at this now that the new league is coming up, great job on managing because this is actually a nightmare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants