how to make anaconda use my default python? - python

how to make anaconda use my default python?
Useful infos
I'm working on 2 pcs one having win10 and the other having a fresh win 11 pro installation.
alongside anaconda I'm using VScode to develop in python, Django, PHP, laravel, js, react. and help me synchronize my settings between both pcs
I installed python3.11 and everything is well configured with VScode (database connection, etc), I also installed pipenv
main
as u see I have 2 python environments already installed
I want to remove the python installed in anaconda and I found a way to do so(I will explain it)
but I don't know how to make anaconda use my global python located in Program Files\python311
however, anaconda has a lot of packages, and I don't know if replacing thepy3.9 installed with them by the systems py3.11 will work or not
removing the python package from anaconda

First of all, where did you get Python 3.11 from ? If it was from the built-in App Store from Microsoft, you should deinstall it. This installation is buggy as hell, and you should consider getting 3.11 from somewhere else.
Secondly, Anaconda will manage the packages for you, so you should install Anaconda once with 3.11 and re-download all the packages you need.

Related

What can I expect to change about how I write python on my Mac after I install conda?

Background
Currently, I have Python 2.7.17 and Python 3.8.1 installed on my Mac (v 10.14.6). Both Python versions were downloaded directly from Python.org using a "macOS 64-bit installer" .pkg file, in late 2019. Both were installed here:
python2: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
python3: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Currently, I use only pip (either pip2 or pip3, depending) to install python packages, which are saved here:
python2: /Library/Frameworks/Python.framework/Versions/X.X/lib/python2.7/site-packages
python3: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
I am about to begin an online course which requires that I install miniconda in order to install the packages that I need for the course. But after having a very bad experience having Anaconda installed on my machine years ago, and it taking me months to remove it and re-create a clean Python install, I am nervous. I don't want my machine to become a mess again, rife with error messages that it can't find this or that python version or this or that python library.
Question(s)
Assuming there will now be multiple installations of Python on my machine (in addition to the versions that I already have, since I believe yet another version of python is installed along with conda), and there will be new places where python packages will be saved, what can I expect to change about how I write python after I install miniconda?
Is there anything I will need to do differently from what I am doing now when I write python code?
How can I ensure that everything remains working and compatible and I avoid the fate I suffered many years ago?
Happy to edit/clarify this question per user suggestions. Thanks!
Use conda environments and install Python into those environments. This ignores, by design, the versions of Python that are installed at the system level. Also, what's installed into environments (other than the one you're in) is ignored. As somebody who uses conda for all Python development, I don't even know what I have installed in /usr/local/bin/ or other places. Everything is in /path/to/miniconda3/envs/env_name_n. You don't have to uninstall other versions of Python you have elsewhere; the point of environments is to keep everything isolated.
What can I expect to change about how I write python after I install miniconda?
Is there anything I will need to do differently from what I am doing now when I write python code?
Use conda environments and use conda as your package manager. For almost every major project, it nearly a drop-in replacement for pip. Outside of managing dependencies, not much changes.

Virtual box python different python version

I'm newbie of python programming.
I have windows 7 laptop and I'm also running virtual box Ubuntu.
I manually installed python3.5 on Win7 through Eclipse first. The default python version in my Virtualbox Ubuntu is 2.7.11.
Is it possible for me to install python packages through my VirtualBox to my Win7 python3.5?
Will it bring any problem with multiple versions of python.
python 3.5 packages do not work with python 2.7 and vice versa.
And I even think that you can't install packages from linux to windows.
I think what you wish to accomplish is to have a same version Python across both machine.
Best way is to go about doing it is to either install Python 2.7.x on Windows 7 or upgrade python 2.7.x on your Ubuntu to Python 3.5.x. Neither is good or bad.
To upgrade your Python 2.7.x to 3.x.x on your ubuntu machine,follow the instructions here.
If you wish to wish to install Python 2.7.x on your Windows,simply download the compatible exe from official page .It will create a folder under c: e.g. C:\Python27 .Thereafter,add the python path to environment variable PATH.
As for installing packages,the command remains the same across both OS.
pip install <package-name>
Usually packages have dedicated versions for different python versions.pip install will automatically resolve versions and install the compatible package version.
The Ubuntu VirtualBox is not just a linux-looking frontend to your existing Win7 install. It's a completely separate OS that runs as if it were on a separate computer. You can set up shared folders to share data between the host and guest, but trying to use Linux to install programs on Windows would be error-prone and risky even if you could do it.
If you plan to be using Python on Windows, you'll need to install the packages on Windows, and a Linux VirtualBox isn't going to help you with that at all. If you're uncomfortable with the Windows command line, read up on some tutorials. There are also some alternative Windows shells that provide some advantages over the built-in CMD.
If you'd rather work on Linux, you can do that, but you'd want to do it entirely inside the VirtualBox. Inside Linux, you could install the version of Python you want, install the packages you want, and use whatever dev tools you want, as if you were working on a Linux computer. (Although in this case I have to wonder why you aren't actually using a Linux computer instead of a Windows one.)

Is there danger in installing 2 versions of Anaconda for Python on one machine?

Some background: I have an intel Mac osx (running Yosemite) and use PyCharm community edition as my main IDE. I usually code in Python 3.4 however, I'm taking some MIT OCW courses which all use Python 2. To make it easier on myself when using MIT's skeleton files I have downloaded Python 2.7 and switch the PyCharm interpreter depending on my project.
Here's my question:
I'm wondering if I would run into any trouble downloading the 2.7 and 3.4 versions of Anaconda.
If this is ok, would I need to do anything special with my import commands depending on which version of Python I'm coding in?
Thanks! Happy to add clarity / more info if this isn't enough to answer my questions.
There's no danger, but it's also not the recommended way of achieving this. Rather, you should use conda, the package manager that comes with Anaconda, to create an environment for the other version of Python. For instance, if you started with Anaconda3,
conda create -n python27 python=2.7 anaconda
would create an environment called python27 in ~/anaconda/envs/python27 with Python 2.7 and all the packages from Anaconda. You would then point to ~/anaconda/bin/python or ~/anaconda/envs/python27/bin/python depending on what version of Python you want. In the terminal, use source activate python27 and source deactivate to switch between the two.
See http://conda.pydata.org/docs/ for more information on conda.

Duplicate Python Installations

I had a manual installed python 2.7.5 version.
And since I need to use some statistical packages, I found anaconda to be more convenient, and installed anaconda, which include python 2.7.6
I have the following questions:
do I essentially need to remove/uninstall the previous manually installed version to avoid potential dependency problems?
Was trying to remove, but not successful so far, any hints? I followed suggestions on this board: How to uninstall Python 2.7 on a Mac OS X 10.6.4?, but find no luck yet.
will the previously downloaded/installed packages still work in anaconda, e.g., I launched NLTK in anaconda's python, and the previously downloaded corpuses are still there installed?
You should use virtualenv. Virtualenv allows you to create a virtual python environment for each project, so you can have different libraries for different projects, this includes different python versions.

Removing python and then re-installing on Mac OSX

I was wondering if anyone had tips on how to completely remove a python installation form Mac OSX (10.5.8) ... including virtual environments and its related binaries. Over the past few years I've completely messed up the installed site-packages, virtual-environments, etc. and the only way I can see to fix it is to just uninstall everything and re-install.
I'd like to completely re-do everything and use virtualenv, pip, etc. from the beginning.
On the other hand if anyone knows a way to do this without removing python and re-installing I'd be happy to here about it.
Thanks,
Will
Just for everyone else's reference. I found this in the Python documentation here:
Mac OS X 10.5 comes with Python 2.5.1 pre-installed by Apple. If you wish, you are invited to install the
most recent version of Python from the
Python website
(http://www.python.org). A current
“universal binary” build of Python,
which runs natively on the Mac’s new
Intel and legacy PPC CPU’s, is
available there.
What you get after installing is a
number of things:
* A MacPython 2.5 folder in your Applications folder. In here you find
IDLE, the development environment that
is a standard part of official Python
distributions; PythonLauncher, which
handles double-clicking Python scripts
from the Finder; and the “Build
Applet” tool, which allows you to
package Python scripts as standalone
applications on your system.
* A framework /Library/Frameworks/Python.framework,
which includes the Python executable
and libraries. The installer adds this
location to your shell path. To
uninstall MacPython, you can simply
remove these three things. A symlink
to the Python executable is placed in
/usr/local/bin/.
I removed these and the virtualenv directories. Then I re-installed everything and its working fine now.
You should be able to delete the packages you've installed from /Library/Python/2.*/site-packages/. I do not think any package installers will install by default to /System/Library, which should save you from needing to remove Python itself.
That said, you could also use virtualenv with --no-site-packages, and just ignore whatever packages you've installed system-wide without needing to remove them.

Categories