How to get Spyder import the version of the module that is being shown in Anaconda navigator? - anaconda

I have just installed Anaconda on my Windows PC to write Python code with Spyder, and I want to use type annotation TypeAlias from module typing. Since TypeAlias was introduced in version 3.10 of typing, I have installed that version from Anaconda, and the Anaconda navigator confirms that I have 3.10.0 installed:
This I can also check by printing the list of packages with conda list in the Terminal. Fine.
Going back to Spyder console, doing import typing and checking the module location, I get this:
The file typing.py that is being referred to is some pre-3.10 version of typing that does not define TypeAlias, so it cannot be the file that was copied when I installed typing from the Anaconda navigator.
I have searched around, but I cannot figure out how to get Spyder use another file for that module. What am I supposed to do to have Spyder use the version of the module that is shown in the Anaconda navigator instead of the outdated version that came with Anaconda on installation?

Related

Can Jupyter Notebook run on Windows 10

I installed Jupyter Notebook on Windows 10. But I got an error when launching it in Visual Studio Code as:
jupyter : The term 'jupyter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
After searching online, I decided to install Anaconda first and run Jupyter from it. But launching it from Anaconda was directed to a web address. It looks like Jupyter is only a web application.
I wonder if it is possible to run the Jupyter Notebook as a desktop application on Windows.
There is a JupyterLab Desktop App, see here and here. I don't know how old of a version of Windows works for it.
Rest was built from discussion in comments:
On Jupyter with VS Code:
Jupyter itself works with VScode to run Jupyter notebooks in VScode. You wouldn't need the JupyterLab Desktop App in that case. You do need Jupyter though. See here if you are interested in using Jupyter notebooks in VSCode.
On installing packages that worked before installed Anaconda:
The easiest solution would be to reinstall them. It is possible you could add the already installed ones to your path, but if you have room it is easiest to keep your Anaconda installed stuff where it is and separate from what you had. The easiest way to sort where to install them is to let Jupyter handle it. For example, if you want to work with Pandas in a notebook, in that notebook run %conda install -c anaconda pandas, based on here and the magic install command. For the packages that conda cannot install, and only for those, use %pip install <package_name>.
You can delete the install commands out of the notebook after if you want. You may just want to comment them out so you remember. For the short term you are fine re-running the commands because if the package is already installed by conda or pip it won't get reinstalled; however, if the package gets a new release and you aren't specifying versions, you'll get the latest when that install command next runs and if there is an error or incompatibility, then you'll have caused yourself an issue you could have avoided.

Spyder Debugger Crashes

Mac OS 12.2.1
Anaconda Navigator 2.1.2
Spyder 5.1.5
I’ve been to the Spyder Web site, performed what was described as “Basic First-Aid” as well as “Emergency CPR” without satisfactory resolution. The first symptom was that the debugger just hung. After performing the suggested fixes (updating Anaconda, Spyder, and Spyder dependencies, system re-boot, etc.), the debugger now reports: “OperationalError: attempt to write a readonly database.”
I’m at my wits’ end. I’m wondering if I need to completely re-install all of Anaconda. Is there a “best way” to do this? Is there a web site that I can consult that will demonstrate how to get a fresh installation?
ADDENDUM
So, I cleaned Anaconda from my machine (what a horrific experience!) and re-installed it, using conda for both tasks. I started Anaconda and then launched Spyder. Then I loaded one of my modules, set a brake-point in the editor, and boom! The Spyder debugger worked. However, the new installation of Anaconda was lacking a particular library: pyreadstat. I used conda to get this library. I then launched Anaconda again, saw that pyreadstat was now in the base(root) environment. I ran one of my packages (8 modules mainly consisting of numpy and itertools manipulations of N-D arrays) and everything worked, including calls to pyreadstat to read SAS datasets. Okay, everything seemed copacetic. So, I tried to debug one of my modules and the debugger failed again, returning the message: “OperationalError: attempt to write a readonly database.” WTF! Is conda trashing Spyder’s debugger in some mysterious way? I don’t get it. Why would pyreadstat affect Spyder. It must be conda.
To answer my own question, in the Mac Terminal app, I typed:
--> conda install -c conda-forge spyder=5.2.2
Boom! All is well.
I had the same problem on Windows10 with spyder version 5.1.5.
For me, updating Spyder to the newest version as suggested here worked as well. This can be done in two ways:
Console
Open the console or, if you're working on Windows, the Anaconda Prompt and type the following commands in order to first uninstall spyder, and then re-install the newest version (just updating didn't work for me).
conda remove -n myenv spyder
conda install -n myenv -c conda-forge spyder
The first command, remove, uninstalls spyder in the virtualenv called 'myenv'. If you don't use virtualenvs, just leave the -n myenv aside.
The second command, install installs spyder from the third-party channel conda-forge instead of the official channel defaults. This option is necessary in order to install a spyder version newer than 5.1.5
Anaconda Navigator
Uninstall Spyder: In the "Home" tab, select the correct virtual environment in the "Applications on" dropdown menu. Then click on the gear symbol in the upper right corner of the spyder tile and select "remove application".
Add conda-forge to your environment's channels: This is nicely described at the bottom of this page.
Install spyder again, in the way you did it the first time.
Click again on the gear on the spyder tile, choose "install specific version" in order to update to the newest version. Now, versions newer than 5.1.5 should be available.

Anaconda Spyder 4.1.5 updates

I have the most recent Anaconda navigator on both my Windows and Linux machines, but when i open Spyder on either machine it tells me that Spyder 4.1.5 is available and i should install it. I can't do this through navigator.
The Anaconda page says to run 'conda install -c anaconda spyder' to install Spyder 4.1.5. link: Anaconda.org page On my linux machine this just tries to install Spyder 4.1.4 (Ubuntu screeenshot), I get the same result with windows (windows screenshot)
It seems this is a regular issue, what is the point of relesaing a piece of software and then not allowing it to be downlaoded and installed in the very manner that both Anaconda and Spyder tell you to do it?
Since you seem to have a previous version installed, did you try a simple update from the conda prompt?
conda update spyder --dry-run
Just remove the --dry-run part if everything looks fine.

JupyterLab not updates in Anaconda Navigator GUI

Goal
Updating Jupiter Lab to it's newest/2.1.5/2.xyz version and have that updated version in my Anaconda Navigator GUI
Setup
macOS 10.12
Anaconda Navigator 1.9.12 (Updated to in the 1st step)
Tried Solutions
Updated Anaconda successfully to current most up to date version of 1.9.12
Used Anaconda Navigator's GUI Settings gear/Update -> loads for a long time than loading bar disappears than nothing happens, even if I restart Anaconda Navigator
Used Anaconda Navigator's GUI Settings gear/Update to specific version -> loads for a long time than loading bar disappears than nothing happens, even if I restart Anaconda Navigator
conda update jupyterlab successful installation but in the Anaconda Navigator GUI nothing has changed -> I still have version 0.34 https://stackoverflow.com/a/55792531/10270590
conda update -c conda-forge jupyterlab successful installation but in the Anaconda Navigator GUI nothing has changed -> I still have version 0.34 https://stackoverflow.com/a/58209396/10270590
jupyter --version
OUT: 4.4.0
I have deleted all files of my Anaconda Navigator https://nektony.com/how-to/uninstall-anaconda-on-a-mac
Done a fresh install https://www.anaconda.com/products/individual -> Anaconda Installers/MacOS/Python 3.7/64-Bit Graphical Installer (442 MB)
Than if I open up the fresh install of Anaconda Navigator/ Jupyter Lab/ settings gear/install specific version/ the highest version is offered is 1.2.6 what is also installed with the fresh install.
So my guess is that for my system this is the highest version available

Can't find Anaconda navigator or Anaconda prompt

I install Anaconda vs 2019.10 on my Windows 10 but I couldn't find the shortcuts to it.
I've tried searching for it using CMD but it's returns the message that Anaconda can't be found
And I can't also find jupyter notebook or spider
Reinstall Anaconda and don't change the default settings. Everything will work as expected. C:\Users\user_name\AppData\Anaconda3\condabin will be added to your PATH and you'll only need to conda activate (or run the Anaconda-Prompt shortcut) to start using Python.

Resources