How to update to spyder‑kernels=2.2? - python

Recently I started using Spyder for my python programming. One of the Code required QT version greater than 5.12 so I installed standalone version of Spyder. To install additional packages I am using Anaconda. Despite of creating virtual environment I am not able to use Spyder as kernel throws error. " The Python environment or installation whose interpreter is located at
/Users/ugowda/opt/anaconda3/bin/python
doesn't have the spyder‑kernels module or the right version of it installed (>= 2.2.1 and < 2.3.0). Without this module is not possible for Spyder to create a console for you.
You can install it by activating your environment (if necessary) and then running in a system terminal:
conda install spyder‑kernels=2.2
or
pip install spyder‑kernels==2.2.*"
Tried several online suggestions,didn't work. Did anyone face similar problem ? Do anyone has solution ?

I used this command after I activated my env:
pip install spyder-kernels==2.2.1

Related

Spyder can't find installed modules with pip

I first installed Spyder and then afterwards Python on a server (with Windows Server 2019) all on the directory "C:\Users\wi932\ .spyder-py3" and the Python folder "C:\Users\wi932\Python\Python38". Then I installed many packages (like tensorflow, matplotlib, scikitlearn) by using the command prompt of windows and pip from the directory "C:\Users\wi932\Python\Python38\Scripts" and it was okay.
However, when running Spyder I can't use the packages that I installed using pip. Whenever I run a Python programm with those modules I get an error message "ModuleNotFoundError: No module named 'tensorflow'". So the question is how can I build a "connection" between the pip and Spyder?
Does anyone have an idea? I'll appreciate every comment.
Have you considered installing anaconda?
Spyder comes as a part of this and is easy to install from the anaconda client. You can also create your base environment in the anaconda client and then switch to pip to install packages from there.

Spyder IDE : No module named pip on Mac

I'm trying to use PIP to install pandas on spyder however I keep getting this issue:
/Applications/Spyder.app/Contents/MacOS/python: No module named pip
Note: you may need to restart the kernel to use updated packages.
(Spyder maintainer here) We don't provide pip in our Mac app to prevent people breaking Spyder by installing any kind of packages with it.
The only way to use other packages that don't come with our app is to install Miniconda, create a conda environment after that with the packages you want to use and spyder-kernels, and finally connect Spyder to that env.

distutils and pygame for python 3.7 on a machine running python 3.8

I'm quite new to Ubuntu. On my machine, running Ubuntu 20.04 with Python 3.8, I'm trying to run a program which does not support Python 3.8, but it requires Python 3.7 (FYI, it is Carla Simulator).
I need pygame, but when installing it through pip (python3.7 -m pip install pygame) it raises an error:
ModuleNotFoundError: No module named 'distutils.util'
Now, I have distutils correctly installed and updated at version 3.8.2-1ubuntu1.
Is there any way for me to install a distutils version compatible with Python 3.7 without affecting Python 3.8 and related modules? Or do you have hany suggestion to get pygame for Python 3.7 and running Carla somehow? Could a virtual environment help?
My question is really similar to this one How to install python-distutils but I don't actually require distutils, I just need the program to work...
Thank you
----- EDIT -----
I tried creating a virtual environment using venv, but I got an error due tue unavailability of ensurepip. Googling it, I found it might be related to the fact that my Python 3.7 version might have been installed through Anaconda (I actually can't remember). Running apt-cache rdepends python3.7 I get:
python3.7
Reverse Depends:
python3.7-minimal
Is it safe to completely uninstall current Python3.7 and reinstall it to hopefully get ensurepip? Any suggested code to safely do it?
The easiest solution for you would be to run your program in a virtual environment where you would specify the default python version to be 3.7 I think (see Use different Python version with virtualenv for an example). You can then install all your dependencies inside this environment and not have to deal with any conflicts between the two versions on Python.
Using pyenv you could specify the python version you want to use.
for example:
create a new folder and hit:
pyenv local 3.7.2
then create your virtual env by using pipenv:
pipenv install
then start your journey to building your game.
hope it help.

Can't use Anaconda properly due to package installation error

I'm using Python 3.8 with pyCharm generally but for some Machine Learning tutorial I wanted to use Anaconda Spyder 4.1.2. So when I write in default windows cmd
C:\Users\Ege>python --version
Python 3.8.2
when I write in anaconda prompt:
(base) C:\Users\Ege>python --version
Python 3.7.7
This is the version of my base(root) environment. I searched and found Anaconda supports 3.8 for environments but not for base yet. Therefore I cannot upgrade it to 3.8. Now the problem comes:
When I try to use numpy in Spyder it says there is no module imported called numpy. I went and check my anaconda base environment and yes there is no numpy package. I opened the conda prompt and I wrote
pip3 install numpy
It says:
Requirement already satisfied: numpy in c:\python38\lib\site-packages (1.18.1)
But goddamit you don't allow me to use python38.
Some of you can say okay go make a new environment with python38 and use the packages. However I want to install the packages to base environment. Any ideas ?
Instead of usin pip one should use conda install. the names are not always equal to each other which means sometimes pip install thisPackage is not equal to conda install thisPackage therefore one should search before installing that package to their environment.

Can't upgrade Anaconda base to Python 3.8

I want to upgrade my base environment to Python 3.8. According to the official documentation, I should just run conda install -c anaconda python. This, however, only upgrades Python 3.7, so, in the end:
(base) C:\Users\bob>conda install -c anaconda python
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
(base) C:\Users\bob>python --version
Python 3.7.6
conda update -c anaconda python only updated a number of packages, but not Python itself.
And if I specify a version, like explained here, after two hours analyzing dependencies, the upgrade fails because of conflicts.
I managed to set up a 3.8 environment, but I'd rather upgrade my base environment as it's the one my system path for use outside of Anaconda.
Any suggestion?
It doesn't appear to be possible to update the base version of anaconda to 3.8 yet because of the conflicts you mention. I assume once all the standard packages are updated to support 3.8+ (and updated versions of all dependencies), then the anaconda release will include 3.8.x as the default. This might take a while.
The problem here is version conflicts in the packages that anaconda installs by default. The reason you can install 3.8 in a clean environment is because no other packages are installed in that environment, so no conflicts.
This does now present a solution, although it requires reinstalling everything from scratch...
disclaimer: I don't use windows, so adapt my instructions accordingly to your OS.
Remove your existing anaconda install from the path and delete
anything in your bashrc (or windows equivalent) that points to it.
You can just delete/uninstall anaconda, but it's good to have a backup just incase, so leaving it there and removing links to it is a good option.
Download and install miniconda, and put it in your path as you had before.
Install python 3.8 in the base environment conda install python=3.8
Install all the packages that you need to do whatever you do.
Depending on what you install, at some point you may run into the same conflicts that prevent a standard anaconda install from updating at the moment, but that hasn't happened for me.
The latest stable version of anaconda is version 3.7
Please see here:
https://www.anaconda.com/distribution/
There isn't an option to get python 3.8, this is due to anaconda sometimes running a version behind the release of python.
I had the same issue and found there is a 2020-07 release of Anaconda with Python 3.8 https://www.anaconda.com/products/individual

Categories

Resources