I updated my Spyder today to Spyder 5.1, and now it keeps showing me this error message:
Your Python environment or installation doesn't have the spyder‑kernels module or the right version of it installed (>= 2.1.0 and < 2.2.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.1
or
pip install spyder‑kernels==2.1.*
I already tried both commands, the pip one works but I still get the error message, the conda command does not even work and shows me
The following packages are not available from current channels
Normally I use conda for all packages that are availabel on conda, so maybe someone faced the same issue?
Version 2.1 is only available through Conda Forge at this time. Try
conda install -c conda-forge spyder-kernels=2.1
So far I've had to remove spyder-kernels from any env from any env that has it before I'm able to get it to install on any other env. I'm using conda. It seems I can't have more than one env available for use without constantly swapping where spyder-kernels is installed. This is the case for Windows 10 and MacOS. The spyder docs say to just ignore the issue - and that it was allegedly fixed by now - but I don't know how to ignore an error that makes it impossible to start a python console.
Correction: After erasing all envs and starting over from scratch (zero envs), I am now able to install spyder-kernels on multiple newly-created envs and each one functions in console without an issue.
I recently created a new Anaconda (Windows) environment in order to move from tensorflow 1.2 to tensorflow 2.0. My base environment is 1.2, and I created tensorflow-20 in order to install the new version. I did the install from the anaconda command line within the (tensorflow-20) environment. But now everything is messed up.
Now, in Anaconda Navigator, it still shows Tensorflow 1.2.1 as the installed version for base. But in the (base) environment from the Anaconda command line, it shows the version as 2.0.0. Furthermore, in Anaconda Navigator, tensorflow-20 shows no installed packages, including python even.
I feel like I'm fundamentally misunderstanding something here. Can anyone provide some guidance?
How did you install tensorflow 2.0 in the new conda env?
IF with pip, run 'where pip' see if you are using the pip installed
in the base env. You can run 'conda create -n tensorflow-20 pip' to get a pip installed in the new env. Then activate tensorflow-20 and install tensorflow 2.0 with pip.
IF with conda, run 'where conda' to check the same thing.
Preface:
If you install Anaconda on your local machine, it makes sense to install it as Admin. However, if this is not possible, e.g. on an enterprise-managed computer, you must carefully check to use only folders where your user has write permission.
Contribution:
After having experienced a cracked-up package management, I read deeper into that topic. Best Practise: Always try to install everything via conda / Anaconda and best possibly from their central repositories.
If you have a special package, which is e.g. built by local software developers and not published, you can install it from the .tar archive. At that point, I am referring to following documentation: https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/
I'm setting up an autoclicker in Python 3.8 and I need win32api for GetAsyncKeyState but it always gives me this error:
>>> import win32api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing win32api: The specified module could not be found.
I'm on Windows 10 Home 64x. I've already tried
pip install pypiwin32
And it successfully installs but nothing changes. I tried uninstalling and re-installing python as well. I also tried installing 'django' in the same way and it actually works when I import django, so I think it's a win32api issue only.
>>> import win32api
I expect the output to be none, but the actual output is always that error ^^
Solved
If you are working in a miniconda on conda environment. You could just install pywin32 using conda instead of pip.
This solved my problem:
conda install pywin32
For my case, install and reinstall pywin32 doesn't help. After copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32, it works.
My environment is python 3.8 in miniconda. The two files are pythoncom38.dll and pywintypes38.dll.
For me, it worked by downgrading my pywin32 from version 227 to version 224. Just type the following command on any shell in administrator mode:
pip install --upgrade pywin32==224
Run Scripts\pywin32_postinstall.py -install in an Admin command prompt
ref: https://github.com/mhammond/pywin32/issues/1431
edit: User #JoyfulPanda gave a warning:
Running this script with admin rights will also copy pythoncom37.dll, pywintypes37.dll (corresponding to the pywin32 version), into C:\WINDOWS\system32, which effectively overwrites the corresponding DLL versions from Anaconda already there. This later causes problem when openning (on Windows) "Start Menu > Anaconda3 (64-bit) > Anaconda Prompt (a_virtual_env_name)". At least Anaconda 2019.07 has pywin32 223 installed by default. Pywin32 224 may work, but 225-228 causes problem for Anaconda (2019.07)
The answer is in jupyter notebook github.
https://github.com/jupyter/notebook/issues/4980
conda install pywin32 worked for me. I am using conda distribution and my virtual env is using Python 3.8
This happens when Lib\site-packages\pywin32_system32 is not in the list of directories to search for DLL (PATH environment variable).
pywin32 (or one of its dependencies) adds this path at runtime to the PATH variable. If this is failing, or another component is overriding the PATH after it's been set by pywin32, you will get the given error (ImportError: DLL load failed while importing win32api).
You can try to extend the PATH variable in the shell before starting Python.
On Windows:
set PATH=c:\...\Lib\site-packages\pywin32_system32;%PATH%
If that doesn't work, then the PATH maybe overridden within the Python program at runtime. Add the following line to your program just before pywin32 is used to verify its value:
import os
print(os.environ["PATH"])
As a last resort, you can extend the PATH variable before pywin32 is loaded:
Windows:
os.environ["PATH"] = r"c:\...\pywin32_system32;" + os.environ["PATH"]
Unix like:
os.environ["PATH"] = r"/.../pywin32_system32:" + os.environ["PATH"]
According to pywin32 github you must run
pip install pywin32
and after that, you must run
python path\to\python\Scripts\pywin32_postinstall.py -install
taken from here. worked for me!
For python 3.8.3, pywin32==225 worked for me, the existing pywin32==228 was uninstalled.
So try this
pip install pywin32==225
Hope it solves your problem
What helped me was
installing relevant binary from github.com/mhammond/pywin32
executing the following commands in the x64 command line:
cd C:\ProgramData\Anaconda3\Scripts
python pywin32_postinstall.py -install
As of February 2022, downgrading tot version 303 of pywin32 solves the issue.
Check your pywin32 version:
pip show pywin32
Downgrade to version 300:
pip install pywin32==300 --upgrade
Restart Jupyter
pypiwin32 is an outdated distribution. Uninstall it and install pywin32:
pip uninstall pypiwin32
pip install pywin32
You should try some (or all) of my methods:
Run terminal and use this command: conda install pywin32.
Copying the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 (there are only 2 files in this folder) and paste to C:\Windows\System32.
In my case, the two files are pythoncom38.dll and pywintypes38.dll (it means my Python version is 3.8).
Downgrading the version of pywin32 to 225 or lower by this command: pip install pywin32==225.
Windows 10, Python 3.8, PyWin32 v.302 using Anaconda
Here is what worked for me
Open an elevated command prompt activate environment
Windows Key
Type cmd
Right click Command Prompt and click Run as Administrator
conda activate [ENVIRONMENT]
Navigate to the environment you installed PyWin32 on, works if pip install or conda install is used
cd C:\Users\[USER]\anaconda3\envs\[ENVIRONMENT]\Scripts
Run the post install script that was added when installing PyWin32
python pywin32_postinstall.py -install
Yes it works!
C:\ProgramData\Anaconda3>py Scripts\pywin32_postinstall.py -install
Parsed arguments are: Namespace(destination='C:\ProgramData\Anaconda3\Lib\site-packages', install=True, quiet=False, remove=False, silent=False, wait=None)
Copied pythoncom38.dll to C:\WINDOWS\system32\pythoncom38.dll
Copied pywintypes38.dll to C:\WINDOWS\system32\pywintypes38.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.8\Help[None]=None
-> Software\Python\PythonCore\3.8\Help\Pythonwin Reference[None]='C:\ProgramData\Anaconda3\Lib\site-packages\PyWin32.chm'
Registered help file
Pythonwin has been registered in context menu
Creating directory C:\ProgramData\Anaconda3\Lib\site-packages\win32com\gen_py
Can't install shortcuts - 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 3.8' is not a folder
The pywin32 extensions were successfully installed.
version 228 works best for me in Windows 10
pip uninstall pywin32
pip install pywin32==228
Jupyter notebook github has the issue mentioned in the question. There are multiple solution proposed.
What worked for me was this answer with additional first step:
pip uninstall pywin32
pip install pywin32
python [environment path]/Scripts/pywin32_postinstall.py -install
In the referecne to this comment question
where is this Lib\site-packages\pywin32_system32 path?
Go to C directory, Users , your username , anaconda3 ,Lib, site-packages,pywin32_system32. you can find easily.
C:\Users\HP\anaconda3\Lib\site-packages\pywin32_system32
Currently there are two copies of the pythoncom*.dll files in directories.
Pycharm is using the copy in directory C:\Windows\System32:-
C:\Windows\System32
C:\Users\sharandi\AppData\Local\Programs\Python\Python38\Lib\site-packages\pywin32_system32
The files are: -
pythoncom38.dll - 559 KB
pywintypes38.dll - 138 KB
I downloaded and installed the latest Microsoft Visual C++ 2015-2019 package from
(https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads). You may have to restart your machine after installation.
Then from conda command prompt activate your virtual environment and go to the Scripts folder of the virtual environment(>cd "path of venv"/Scripts)
Once you are in the Scripts folder run the following command
"python pywin32_postinstall.py -install"
This will install the required dll's to the appropriate folders in the virtual environment.
And that's how I got it to work!
I have had this issue with Jupyter in Anaconda. After following all listed advices, without clear understanding what I am doing, nothing worked for me except one thing. I have updated indexes of Anaconda environments and I've got my kernels back. The screenshot
This problem for me occured when recreating venv from requirements.txt. This venv was initially created on Ubuntu Linux and then recreated on Win 10.
I had to clear the environment and install everyrhing again manually. Did the work for me.
Solved
I tried uninstalling and reinstalling pywin32 multiple ways, but the problem persisted. The following way solved the problem:
pip install --upgrade jupyter_client
pip install --upgrade pywin32==224 --force-reinstall
hi this question i'm solve as below:
1.check directory C:\Windows\System32, is exist these file?
pythoncom37.dll pywintypes37.dll or pythoncom36.dll pywintypes36.dll
the number is python version .
if the file is exist delete it.
and then this issue will be solve.
You should go into the folder {python folder path}/Lib/site-packages/pywin32_system32 and copy pythoncomXX.dll and pywintypesXX.dll to the folder C:/Windows/System32.
If you are using a virtual environment, then {python folder path} is the python folder used by the virtual environment, otherwise it is the folder where the global python is located. For example, I use conda to create a virtual environment called Frameless-Window, and install the package pywin32 in this virtual environment, then the {python folder path} on my computer should be D:/Anaconda/envs/Frameless-Window.
You should be very careful when copying the dll to the System32 folder. if there are dlls with the same name in the folder and pywin32 in your other virtual environment may use these two dlls, replacing the original dlls may cause this virtual environment had the same ImportError problem. After testing, I found that the dlls of pywin32 of version 227, 228 and 300 can be replaced with each other, and the dlls of pywin32 of versions 301, 302, 303 and 304 can also be replaced with each other, but if the dll of version 300 is replaced with the dll of version 301, it will raise ImportError.
If you are launching a virtual env from another virutal env. Makes sure to install pywin32 in both envs. Lost way too many time with this....
This worked for me
conda install -c anaconda pywin32
Its about venv or virtualenv version problem about pywin32
check version of both of version of pywin32 (pip install pywin32)
than run this command on active venv
pip install --upgrade pywin32==305
Maybe a bit late but it could help:
What happens is that you have two versions of pywin32 installed (One in the local enviroment and the other one in the main python installation)
To solve that uninstall both versions with:
conda uninstall pywin32
pip uninstall pywin32
And inside your virtual conda enviroment also execute:
conda uninstall pywin32
or
pip uninstall pywin32
finally in your virtual enviroment / conda enviroment install with pip install pywin32 or conda.
The answers telling that it works with x version is because the version they install are compatible with the pywin32 dlls they have in system32.
Adding a support link: "DLL load failed: The specified procedure could not be found" when importing win32api or win32com
I had the same issue after reinstalling anaconda 3.9 instead of 3.7 and placing inside the former env folder.
I launched the Anaconda Prompt application then typed in
cd C:\Users\%USERNAME%\anaconda3\Scripts
activate.bat
I suspect it updated the pythoncomXX.dll and pywintypesXX.dll used by anaconda.
That is Simple. After Many Tries, I Discovered a Solution. Just Type the Following Commands in Windows 10. I am Using Pycharm, Python Version 3.9
Note:- This Works for All Python Versions !!
pip uninstall pywin32
pip install pywin32
That is Simple.
if That Does Not Work, Then Try:-
pip uninstall win32api
pip install win32api
After Trying These Commands, Try the first 2 commands again.
If It is Still Not Coming, Then Comment This Question What the problem is !!
My conda is corrupted after I run command "pip install conda". Is there any way to recover it ? Thanks
Here's the error I see when running conda command
ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer. You can download the miniconda installer from
https://conda.io/miniconda.html.
Simply, follow the instructions given in the error:
Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g.
bash Miniconda3-latest-Linux-x86_64.sh.
Now reopen the terminal for the changes to take effect.
If conda is already installed on your system, you can reinstall it with the -f force option, for example,
bash Miniconda3-latest-Linux-x86_64.sh -f
To test your installation, enter the command conda --version. If installed correctly, you will see the version of conda installed.
miniconda: https://conda.io/en/latest/miniconda.html
conda troubleshooting: https://conda.io/docs/troubleshooting.html
If you are facing this problem in Virtual Machine (VM) then you have to activate the main environment by running below line of code:
source /anaconda_installation_folder_path/bin/activate
Once you are in your main environment you can work with conda.
TL;DR: nothing is corrupted, the message you're seeing is a hardcoded stub and could be fixed.
conda package manager actually can be used with regular python installation.
Update: I've been tinkering with the described method and found that you should use conda install --dry-run ... to see changes that are going to happen. Some conda packages depend on other python version, which would overwrite the installed one. There's might be a solution for this with changing conda channels or using virtualenv. I also found that --dry-run doesn't work when using local package archives.
I'll show you how to run cudatoolkit 9.1 without any Anaconda and python-3.6-amd64. I'm using cuda 9.1 from here.
Since conda is artificially tethered with Anaconda, you have to untie them.
I recommend you to backup up python installation directory you'll be working with (or use virtualenv).
Install menuinst dependency.
At the moment, it's broken from PyPi, so get if from
github. Build it and install python setup.py install
This package is problematic also in Anaconda distribution. It triggers series of requests for admin rights every time, which should be suppressed with conda ... --no-shortcuts option.
pip install pypiwin32, dependency of (1)
pip install conda, requires (1)
Move to python installation directory. ./Scripts/conda.exe should exist.
Move to ./Lib/site-packages/conda
Search directory recursively for pip_warning substring in following TEXT file types: .py, .json, .txt
Replace matching substrings pip_warning with main
Don't forget to abide the syntax of file types you'd be editing.
Now open the ./Scripts/conda.exe executable in any hex-editor and
find pip_warning, carefully overwrite it with main and wipe the
rest with spaces until bytes import main
Check for file size not have changed.
Remove any __pycache__ dirs if found in ./Lib/site-packages/conda
If you only need working conda without cuda, you're done here.
Run conda install mkl, pip install llvmlite numpy
Download packages cudatoolkit-9.1-0.tar.bz2
and numba-0.36.2.tar.bz2
and run
conda install cudatoolkit-9.1-0.tar.bz2
conda install numba-0.36.2-***.tar.bz2
Wait a little while unpacking finished.
Now try these examples, they should work and your gpu monitor show some activity. conda ... commands also do work.
With Linux, I guess instructions are the same, just would be .sh or ELF in place of .exe.
In my case, what worked was:
pip uninstall conda
and then installing miniconda
Download miniconda, then run the script file by typing following command: bash <file_name.sh> e.g. bash Miniconda3-latest-Linux-x86_64.sh -u
'-u' : update tag, used if the original conda bash paths get lost due to certain modifications in the .bashrc file
I have installed Anaconda and currently using Spyder IDE.
I am trying to install a package (IbPy -> https://github.com/blampe/IbPy) so that it can be used in Spyder.
So far I tried pip install ibpy, as well as conda install ibpy, but without success since the package is not available in the anaconda repository where I would normally update and download the most common packages.
I have also tried to move the folder downloaded from GitHub to the correct site-packages folder of Anaconda (C:\Users\Username\Anaconda2\Lib\site-packages), but still it does not work.
I also tried to run the setup.py (shift + right click on the folder, open new process here, Setup.py install), but without any success.
I tried to look for a solution everywhere, but I have had no luck so far.
If someone more tech savvy than me and practical with these specific could help, it would be highly appreciated.
You need to install it from github. Use the following.
pip install https://github.com/blampe/IbPy/zipball/master
You need to do a open terminal from the Anaconda Navigator and run the command:
conda install -c tibkiss ibpy2