-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make commands operate in current shell environment (not necessarily in the project Python environment) #83
Comments
In this fork I managed to tackle the problem. It is not 100% related, but note, I am assuming availability of |
Yep, you've picked out what is consistently a sticky issue with environments generally. It's not possible to activate a virtual environment within the Makefile and then will have that environment available to the user at the command line. We currently take the approach of alerting the user with a message that they need to manually run a command. Feel free to reopen if you've got suggestions that are clean and will work consistently across platforms. |
I believe my suggestion as I linked above is by far superior in comparison to a warning. With the current implementation the following two steps: make create_environment
make requirements would install in the requirements in the root of conda. This is very bad from the user's perspective. Basically, in the Makefile, whenever there's a call depending on the environment (this applies also to @pjbull I would be happy to understand what is the downside/wrong with my approach in your mind. |
No real downside except that for nearly all use cases a user will need to activate the environment as part of their workflow anyway to do development. I've also got the minor aesthetic quibble that it's repeated all over and as we maintain the project, we'll have to keep track of which commands need the environment active and which ones don't. From that perspective, I almost like the idea of a dependency that checks for the activated environment and bails if it's not active instead with a warning. Other thing we'll want to make sure is that it works for both Thoughts? |
The bare minimum is to exit the make process if the virtual environment has to be activated in the shell but it is not. Otherwise, the issue I mentioned with modifying the root can easily happen. This, by the way, in my mind, is much more dangerous. Otherwise, enclosing each statement in the At least for the time being, I will try to stick with enforcing |
Agreed people accidentally overwriting their base site-packages is annoying (maybe not dangerous). Reopening this to see if someone has time to put together a PR that has a script (or preferably just a make command) to check if the environment is active. |
I added in the
In turn, here's a sample target:
I didn't try yet to figure out how to check whether For reference: I reused code from here |
@drorata original link doesn't work. I think he meant this: https://github.com/drorata/ds-cookiecutter/blob/master/%7B%7B%20cookiecutter.short_prj_name%20%7D%7D/Makefile |
Thanks for providing this cookiecutter template! Should requirements get installed into the correct conda environment when doing this?
It seems like I am still getting global installs like that. |
Oh, it seems like I had |
I exploring further the tool and I have two comments:
If the default python of the system is version 3.x, and a new project with version 2 is chosen, then the environment testing fails. The reason is that it tries to use the global
python
which is version 3.x.Second issue, after creating the environment (assuming no problem with the python version), then
make requirements
uses the globalpip
and thus installs everything into the root of conda. I either missed something, or there's some wrong in the flow. It seems not to be possible to activate a conda environment from within theMakefile
. So, basically, the user has to activate the environment before runingmake requirements
.What do you think?
The text was updated successfully, but these errors were encountered: