-
Notifications
You must be signed in to change notification settings - Fork 220
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
creating virutal environment using virtualenv is breaking with anaconda setup #305
Comments
I am also facing same issue with conda. Not sure what is the problem. |
Hey @patelkunal. This is a common point of confusion and something we're trying to clarify better. You don't need to use virtualenv with conda. Conda has environments baked right in. In place of creating the virtual environment, you create a conda environment. For example (using virtualenv-wrapper): mkvirtualenv my-dev
workon my-dev Becomes: conda create -n my-dev python=3.4
source activate my-dev Now you're in something that works just like a virtual environment. Pip is automatically installed along side Python, so you even have pip for managing packages that way if you want to. |
I agree @tswicegood. It really helpful that we can do similar stuff with conda itself. My next question would be, how can we export project dependencies to something called requirements.txt or other simple format. I am sure that there must be something similar in conda as well. My personal opinion - I like this approach because it becomes extremely easy to ship all dependencies in one text file. And it makes deployment easy. Another thing is virtualenv is managing everything in separate directory itself which makes you very confident about not messing up with system installation. P.S. I have activated root environment (I guess that is default) and then installed all common dependencies like IPython, pip and virtualenv. Then just use virtualenv for all project development work. |
Conda can export the environment info. If you want to export the environment Conda environments are stored in the |
Dealing with this issue as well. The problem I am still dealing with, after exporting the conda config, is that we cannot create a conda virtual-environment in a separate folder. we want to create a folder structure like this: I'm fairly sure this is common practice, but i'm just following the Test-Driven Development with Python book (https://github.com/hjwp/book-example/tree/chapter_08), and conda is making it difficult to follow. |
@tswicegood Many tools for testing (e.g., tox) rely on virtualenv for running their tests. This bug therefore completely breaks my unit testing workflow since it always gives an |
Any updates on this? It is still failing with current latest version. :( |
Were looking at using virtual env to enable consistent linting but in the current state it seems like we need a seperate path in out shell scripts just for conda users, it would be nice if virtualenv and conda played nice together - but alternatively some clear error messaging around this would be pretty helpful too. |
We released a new |
My suggestion is that you can install virtualenv with Mac's built-in version of python. Like that
Then every time you call virtualenv, it's in fact calling the one that under the control of a different |
The issue is that conda's virtualenv was broken, so clearly people reporting this issue want to use conda with virtualenv, so your advice of "don't use it" is somewhat redundant. |
I believe I am having the same issues. I installed Anaconda with Python3 and used IPython for awhile. Today I went to the regular Python and wanted to create a
The same error show when I run If anyone has an idea of how one could fix this, please let me know. |
Correct me if I'm wrong, but from what you've said and the above, it would appear that somehow a virtualenv created by your 'regular Python' broke Anaconda's Python. Regardless, if you want to use |
@mingwandroid I cannot run conda because I get the same error. Basically, I need to get Python3 working somehow for my regular projects. Any suggestions on how I could do that? |
Install miniconda3 over the top of your current installation.
…On Mar 10, 2017 3:20 AM, "artforlife" ***@***.***> wrote:
@mingwandroid <https://github.com/mingwandroid> I cannot run conda
because I get the same error. Basically, I need to get Python3 working
somehow for my regular projects. Any suggestions on how I could do that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#305 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA_pdHmnUaxzgRzG2fCZ_0XBX0uL7bCOks5rkMGHgaJpZM4EAIam>
.
|
@mingwandroid I did this now and it seems to have fixed the problem in the sense that I now have two more Pythons (2.7 and 3.6) which came with Miniconda. Could you tell me why you thought this was going to work? What is Miniconda? Can I now wipe the Anaconda itself? Should I uninstall the original Pythons which I installed through |
Miniconda3 does not come with two Pythons, it comes with Python 3.6 only. Miniconda2 comes with Python 2.7.
This works (if done correctly) because you have a broken Python executable and this procedure will overwrite it with one that works without changing much else in your Anaconda installation.
Please read https://conda.io/miniconda.html and/or https://conda.io/docs/install/quick.html#miniconda-quick-install-requirements
No, because if you installed "miniconda3 over the top of your current installation" then wiping Anaconda would also entail wiping Miniconda3 as you will have installed them to the same location.
I have no idea what commands you issued and what state your environment is in so I cannot answer that. Perhaps you can look at your bash history with the
|
@mingwandroid Understood, thank you. By the way, when I run Also, I believe that I installed Anaconda and Miniconda into different locations. I was not sure what you meant by "over the top of the existing one". That is, both of the directories exist now:
Does this mean that I could wipe the anaconda3? Am I correct to think that Miniconda is just a stripped, bare-bones version of Anaconda? Would IPython still work with the former? |
Both of those executables are probably python3, try:
You'd need to install more packages for IPython to work in your Miniconda installation. You can turn a Miniconda installation into an full Anaconda installation by running Be careful about |
@mingwandroid You were right. Both of those executables return 3.6 as their version. In the spirit of cleaning up, if I wanted to turn Miniconda into a full-blown version of Anaconda, should I simply delete the anaconda3 directory from the user's home directory? What about the ~/.bash_profile?
Is it only this line that needs to be stricken out?
|
Personally, I would remove all of that stuff. I never let programs add themselves to my For conda you should prefer to use activate and deactivate, as in:
You can put this in ~/.bash_profile instead and that will properly activate your environment (which involves more than setting Personally I wouldn't even do that and instead type that command in each terminal where I want to use conda, but I expect some would prefer no to do that. The reason I don't want it in there is because there are times (e.g. when using homebrew) when I do not want conda programs to be run because homebrew will not work right if that happens. |
Could you give an example of this? |
I cannot give a specific example but in general, most programs (and esp. software distros like the Anaconda Distribution and Homebrew) are written with built-in assumptions (even if the authors didn't do that deliberately) about what other exact programs will be run when they run other programs (for example a shell script that calls 'python'). If these assumptions turn out to be incorrect (for example, ArchLinux expects 'python' to always be Python 3 and never Python 2) then things will fail, sometimes catastrophically. |
I call this 'environmental pollution'. On Windows a variant of this is called 'DLL hell': https://en.wikipedia.org/wiki/DLL_Hell Avoiding problems boils down to not adding things globally to your system environment or to the environment of your command line interface to your system (which is what changing |
In this particular case, are you sourcing the conda instead of having it in the PATH because you want to make sure that when |
Yes, but having conda in PATH was never good enough anyway. Activating conda (or activating a conda environment) does more than adding something to PATH:
|
@mingwandroid This works for me, will these patches contribute to the virtualenv upstream?
|
@qytz: not until they are in a good enough state to survive an upstream review and until I have enough time to go through that process. That will not be for at least a month. |
OK, thank you. Does that mean, when using conda, we should install package with |
+1 |
@tswicegood I'd like to use the "normal" virtualenv instead of conda environments. Is there a reason why conda prevents me from doing that? I tend to be using conda when I'm doing chores I don't enjoy, so I'm often fairly grumpy. At these times I often feel like conda has broken my workflow on purpose, just to force me into abandoning my other tools. I know that's probably not true, but still. Grump! Why shouldn't The other reason I don't enjoy using conda environments is that I think it's bad for the one command to have responsibility over the project environment, the Python versions, and package installation. To me it's much better to have pyenv, virtualenv and pip are separate tools. If I write I do think there are times where software authors should answer, "Have you tried not wanting to do that?" to their users. However, I think there's really good reason to want to mix anaconda's tooling with some of the tools it's trying to replace. I hope this can be supported better. |
FWIW, Your objections to
It does work now (for some definitions of 'work').
This is a Python-centric world-view. If you were to create an environment containing the OpenJDK then activation of that environment needs to modify the calling shell environment so that The fact is, |
@mingwandroid Thanks!! I'll be sure to update and try that out. I appreciate that the problem is on both sides, and compatibility across tools is non-trivial. I'd actually read that blog post before. I think it distills my problem here fairly well. The answer to Myth 5 ("conda breaks my workflow"), boils down to "you should change your workflow". But the workflow conda's offering isn't better for me. It doesn't really help me to know about how well conda supports the many workflows I don't have. Thanks again for your reply, and your efforts on the software. Out of respect for your time, I'll read your next reply if you make one, but won't make another myself. |
Just make sure you |
I encountered this problem too. My virtualenv creation even had took 4 minutes to complete. At last, I found that the |
I got this error with a "regular" python virtualenv, created for python3 (specifically 3.6.1). Using homebrew "incidentally" upgraded me to python 3.7.3 (not sure what changes I made) and broke my virtualenv. Just a single symlink change fixed python for me, specifically |
My setup -
And I use virtualenv for development and everything is working perfectly fine with system's python version + pip + virtualenv.
Recently I switched to miniconda to avoid pain of installing numpy and scikit-learn packages manually which fails in compilation most of the time with pip.
But now virtualenv or something which is used by virtualenv is broken with this setup. I am sure that conda supports virtualenv and it should support if not supporting - my personal opinion. We adopted virtualenv since very long time and it makes development setup + deployment very very easy. And I am sure it is the case for many out there.
I am facing following error while creating virtualenv.
After doing some research, I found some patch work which solves above problem. It is explained here
I believe there must be something better you guys can do to fix this problem - may be in next update.
And just FYI - I didn't face the same problem in Windows setup so this may be platform specific.
The text was updated successfully, but these errors were encountered: