0

I have anaconda but now I have to get pure Python and create a venv there. So I install the most recent python. I go to the command prompt, and typing in 'python, I get exactly what I want:

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

So I hit exit(), I set my project folder as a current directory and follow the procedure then to create and activate a venv:

cd ProjectEnv
python -m venv venv
venv\Scripts\activate

All this works fine. However, once I am inside this directory and I again type in 'python', I get the following:

Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda.io/activation

It is crucial I am using the pure python in order to install and use only packages I need in this venv, not the full Anaconda packages.

What steps am I missing to ensure I am always operating in pure Python? I would hate to have to uninstall Anaconda because this is what I have always used (because I hadn't been able to sort out all the import errors that come with Python in Windows).

ISquared
  • 364
  • 4
  • 22
  • Creating a virtual environment > py -m venv env_name Activating a virtual environment > \env_name\Scripts\activate Leaving the virtual environment >deactivate – Sumit Yadav Jul 28 '20 at 20:51
  • Does this answer your question? [How to create virtual env with python3](https://stackoverflow.com/questions/43069780/how-to-create-virtual-env-with-python3) – Trenton McKinney Jul 28 '20 at 20:55
  • _operating in pure Python_ you are operating in pure python. If you are using Anaconda, use the conda environments to prevent headaches. – Trenton McKinney Jul 28 '20 at 20:57
  • @TrentonMcKinney so it doesn't matter if it is finding the Anaconda Python, as long as I am using the venv instead of conda environment? (I would loooove to go back to Anaconda, but just for this case I have to use just Python, as it is the recommended method to reduce the size of my .exe file :( ) – ISquared Jul 28 '20 at 21:05
  • _but just for this case I have to use just Python_ I'm not sure what that means? python is installed in the Anaconda directory. Do you also have a system python that's not in Anaconda? – Trenton McKinney Jul 28 '20 at 21:07
  • Sorry my technical language is a bit off, yes, I have the system Python installed, this is what shows up the first time I type in 'python' in my cmd. And I also have the Anaconda as well. I have to use the system Python, because I have to use only the bare minimum of packages/libraries to create the minimum possible size of .exe file. – ISquared Jul 28 '20 at 21:09
  • I changed the title of my question to make it more clear ... I am not asking how to create a virtual environment at all. I am asking how to make sure, within that environment, it is the system Python that is being recognised, because currently it seems that it is reverting back to Anaconda Python,. – ISquared Jul 28 '20 at 21:13

1 Answers1

1

Must have been while you tried installing anaconda. Anaconda usually gives you options to add it's python to path. It is advisable not to tick that option. It might be okay to uninstall and then reinstall anaconda, without adding anaconda's python to path.

Otee
  • 90
  • 4
  • Thanks for the reply @Otobong, I'm glad you understood my question. Initially I didn't add Anaconda to the path, but later I added it myself manually, I needed it for the installation of some packages. Maybe it's a good idea to uninstall Anaconda anyway :( – ISquared Jul 29 '20 at 08:57
  • Okay you are welcome. You could have still used the traditional pip install anyway. – Otee Jul 29 '20 at 14:11
  • I am using traditional pip install, I never use conda install, even when I use Spyder from Anaconda. So when you use pip, is it always system Python that is being updated? (here's where my gaps in very basic knowledge really show.. sorry) – ISquared Jul 29 '20 at 14:13