Using multiple Python versions with Jupyter - python-3.x

I am using Anaconda installers and have Python 2 installed. I however, do want to use both Python 2 and 3 interchangeably in Jupyter Notebook. I read through the instructions provided in Installing the IPython kernel.
Does it mean that I do not need to install Python 3, just the kernel to start using both Python 2 and 3 in Jupyter?

Conda makes it a breeze. The full documentation should guide to manage both Python 3 and Python 2.

Related

Can Anaconda and a more recent version of Python coexist in Windows 10?

I am taking a beginner course in Python so I downloaded and installed Anaconda on a
Windows 10 OS. It is possible to install the last version of Python, say 3.9.x or 3.10 to be run on VSCode. How do I manage to avoid conflicts between them. Can anyone tell how should I do because I have to use that text editor. Thanks in advance.
Yes, but Anaconda includes an environment management tool, Conda, and so it would be more idiomatic to use that to create a new environment, rather than installing a native, system- or user-level Python interpreter. If you are using Anaconda, then from Anaconda Command Prompt try
conda create -n py39 python=3.9
or
conda create -n py310 python=3.10
Note the argument used in the -n (or --name) is arbitrary - feel free to name environments as you'd like.

Manage two different versions of Python

In my system Python 3.8 version already install, but I want create virtual env for version 3.7 on vscode so how can I do>
To work on different environments, you can use Anaconda Prompt.
You can follow the steps given in this: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Can we have specific version of python created using venv - Python 3.4.3 venv using Python 3.9 [duplicate]

This question already has answers here:
How to specify python version used to create Virtual Environment?
(8 answers)
Closed 2 years ago.
Is it possible to create Python 3.4.3 virtual environment using venv when running Python 3.9 in my windows? I have tried with Anaconda also but the options available are only 3.8, 3.7, 3.6, 3.5 & 2.7
If I download and install Python 3.4.3 from python website, will it be ok? Can it run alongside Python 3.9?
P.S. Python 3.4.3 is very old but one of our servers is still using it without the possibility of an update. I would like to first test my web app locally whether it works with Python 3.4.3 before deploying.
(or)
Is it possible to create a Python 3.9 inside Python 3.4.3 venv? that would also solve my problem if it's possible :)
Thanks!
Yes you can install both, but i would advice to store one in user folder and the other on program files. This is to not confuse which python to run on the variable environment unless you set them to two different variable names

Twisted for python3.5?

There is no Twisted for python 3.5 at https://pypi.python.org/pypi/Twisted ,I am using python 3.5.2,what should I do?
I recently encounter a similar problem.
try this Unofficial Windows Binaries for Python Extension Packages
http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
Use command "pip install yourfilename.whl"
I used it to fix the problem while installing scrapy
Each new release of Twisted includes updates that bring full equal functionality to the python3 version. Releases are roughly monthly, so you may find that the module already works for you.
It is possible (for example with virtualenv) to install both python2 and 3 How to install both Python 2.x and Python 3.x in Windows 7
Twisted support of python 3 on windows is lagging a little behind support on other systems. So if you have access to another OS you may find that it will allow you to install twisted for python 3.

Anaconda Python for Gurobi 6.0.4 installation _Py_FalseStruct error

In order to run an optimization problem we set up Gurobi 6.0.4 together with
Anaconda (Version 2.2.0) Python (Python 2.7.9.) on
Linux CentOS release 6.6 (Final) with the 2.6.32-504.16.2.el6.x86_64 Kernel
Following the installation guidelines of Gurobi (listed here: http://www.gurobi.com/documentation/6.0/quickstart_linux.pdf)
everything worked out in the first step. Gurobi was installed, could obtain a license. Also the PATH variables have been set (in the .bashrc) according to the manual, with a little extension for the referal to anaconda python (and not the other local Versions of python (being 2.7 and 3.4):
export GUROBI_HOME="/opt/gurobi604/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin:${PATH}:opt/anaconda/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
Following the procedure we executed: python2.7 setup.py install in the respective directory /opt/gurobi604/linux64. After this usually you could run the import gurobipy command in the python interpreter wihtout errors. For older Versions of Gurobi (as 5.6.3) this works out very well.
For 6.0.4 though we constantly receive the error:
ImportError: /opt/anaconda/lib/python2.7/site-packages/gurobipy/gurobipy.so: undefined symbol: _Py_FalseStruct
This is very reproducible, no matter if we put anaconda also in the global path, and check the bash for any overwriting of the environment variables, which is not the case.
On Windows 8 the Gurobi 6.0.4 and Anaconda Python 2.2.0 work together without any problems.
Also applying hints from here: Python Module Error on Linux did not work out.
Did anyone else experience these problems with this tooling combination? thx.
The error message indicates that you use the Python module for version 3.4 in your Python 2.7 package directory. This can happen if you do not clean your Python module build directory between builds. Please try the following:
Completely remove the 2.7 package from your Python 2.7 installation (e.g. remove /opt/anaconda/lib/python2.7/site-packages/gurobipy)
Completely remove the Python module build directory from your Gurobi installation (e.g. /opt/gurobi604/linux64/build)
Re-run the build process for the Python 2.7 module (e.g. run "python2 setup.py install" in /opt/gurobi604/linux64)
Please note that CentOS is currently a non-supported platform for Gurobi.
Thank you for the hint, I think we tried that, but did not finish the procedure in this way. We tried to clean the system but in that particular case still hat both python Versions (due to other applications that use 3.4) on the machine. Our solution in this case was just to reinstall everything clean on a Ubuntu 14.04 VM. Since then no further problems occured. (I know not the cleanest solution.)
We had some similar issues when we updated to Gurobi 6.5, but that could be solved when corrctly addressing the usual path issues.
Thank you in any case for the reply, I think this really will help us with the next, then clean deployment :-)

Resources