Cannot change jupyter python version after installing python 3.10.6 - python

I did a default installation of Python 3.10.6 from official website in order to use some updated features of package 'math'. While the installation is successful, by printing the sys.path in Jupyter it keeps showing that the currently active version is 3.7.1. The same situation occurs in conda prompt, when I check the version by entering the following command.
(base) C:\Users\p'c>python --version
Is their any way to solve this?

Related

Python 3.11.0: "No module named pip" on Spyder (5.4.0), but Terminal shows "ensurepip" as "Requirement already satisfied"

Hi. I installed Python 3.11.0 and Spyder IDE 5.4.0 a few days ago. It had been running smoothly. I tried entering "pip install pandas" (to install pandas through the console) but it says "no module named pip" (as shown in the picture).
I already ran "py -m ensurepip" through PowerShell but it says "Requirement already satisfied". "pip" is (supposedly) already in my site packages.
The IDE indicates that it's running Python 3.8.10 64-bit, which I thought was the issue (because of Python 3.11.0 being a newer version), but otherwise, Spyder has been working perfectly.
What should I do?
Check the python installation used in your IDE vs the one used in Powershell.
From your screenshot, it looks like the IDE comes with its own python and using that installation. Your powershell is probably using a different python installation.
You can update your IDE to use your system default so that the packages you installed globally are also available in your IDE.

An error occurred while starting the kernel in Spyder

I have been trying to get my Spyder console to stop this error on my Mac Big Sur. I am not sure if there an issue with the version and interpreter I am using, but I am not sure how to switch to another version or have the correct version.
Your Python environment or installation doesn't have the
spyder‑kernels module or the right version of it installed (>= 2.0.1
and < 2.1.0). Without this module is not possible for Spyder to create
a console for you.
You can install it by running in a system terminal:
conda install spyder‑kernels=2.0
or
pip install spyder‑kernels==2.0.*
I have tried both commands in terminal but they fail to download

Problem installing tensorflow in virtual environment

This issue in some form has come up before, however I am having a variant of this issue.
I had python 3.8 installed. Tensorflow does not have a version for this python.
I therefore installed python 3.7 and set up a virtual environment using virtualenv.
In visual studio code I even updated the settings json "python.pythonPath": to the correct path for version 3.7 of python.
I install the correct version of tensorflow using the correct link for 3.7 on the site:
'''pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl'''
But i still get the error
"ERROR: tensorflow_cpu-2.1.0-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform."
When i type python -V I still get Python 3.8.1, could this mean I am not correctly using the virtual environment?
However I have now set up virtual environment using anaconda which is limited to 3.7 and it still says 3.8 when using "python -V" and i get the same error when trying to install.
You can try to either reinstall anaconda, visual studio, or type in the command "pip install --upgrade tensorflow". This should work without the link.
After creating the virtual environment you need to activate it if you haven't already. Once you do, your command line prompt should indicate that a new version of Python, in your case 3.7 is now running.
I ended up using Anaconda with Python 3.6, it seems tensorflow would not work for 3.7 on windows.

Conflicting python version in jupyter notebook(Conda)

I am trying to setup Jupyter notebook using Conda, but the python version being used by notebook is not the same as the Conda environment.
I used the following command to create the 'python_jupyter' environment.
conda create -n python_jupyter python=3.6.5 ipykernel
But in the notebook, when I check the python version I get different results depending on how I am checking it. If I check using bash command I get the expected version number 3.6.5, but from python code, I get 3.6.3(which I am guessing the default one came with default Conda installation).
When I go back to the 'base'(default) environment, the version conflict is resolved,
Why there is a python version conflict in the first image, and how do I resolve it?
Edit
When I run 'conda info' on the command line with 'python_jupyter' environment active I see python version is being reported as 3.6.3. But if I run 'python -V' I see python version 3.6.5. Why this discrepancy? Also when I try to update python using 'conda update python' it doesn't prompt me for an update which means conda thinks I am on the latest python version 3.6.5.
The problem was solved by running conda install ipython jupyter on my python_jupyter environment. Since I were able to run jupyter notebook command with the default installation, I was under the assumption that jupyter notebook installation was complete.
conda info reports the version of Python in the base environment, and conda list or conda list -f python or python -V reports the version of Python in the currently active environment, in this case python_jupyter. Source

conda env is forced to downgrade python version when using matplotlib

I created an environment in Anaconda Navigator and indicated python version as 3.6.4. After the env has completed, I installed matplotlib, numpy and so on, but when I was running Jupyter Notebook on a browser, it's shown the python version - Python 2, like the screenshot shown:
Then, I checked what I installed in this environment in Anaconda Navigator, it's really shown that python version is 2. So I was trying to upgrade python version to 3.6.4, then it's prompted that as shown below, complaining: functools32 and python 3.6.4 can not be satisfied and in conflict.
Then I searched google what is functools32, the result is a dependency of matplotlib
I'm looking forward to get an answer from you. Thanks In Advance.
Updated: April 1st
As the screenshot shown, it hinted to me that Python will downgrade from 3.x to 2.x when I was trying to install PIL.
If you think you created an environment with Python 3.6.4 but the environment actually has Python 2.x then either you made a mistake while creating the environment, or you aren't actually using the environment you created, or one of the packages you installed after creating the environment forced a downgrade from 3.6.4 to 2.x (and I'm not sure if that's even possible).
If you open an Anaconda prompt and type
conda create -n new-env-name python=3.6.4 matplotlib
(where new-env-name is the name you want for your environment) then conda will show you what packages and what versions it is going to install in order to satisfy the dependencies of matplotlib. When I try this it lists Python 3.6.4 (as I asked) and matplotlib 2.2.2, but doesn't mention functools32.
I would try creating your environment from the command prompt as above, and then make sure this environment is actually the active one before using it.

Categories