Python Anaconda ImportError No module named menuinst.knownfolders - python

I am just starting to learn Python. Having used R Studio and Matlab, I was looking for a similar IDE.
I downloaded Python 2.7 and then downloaded Anaconda IDE. However, when I try to open Python using either Spyder/iPython/ Jupyter NB under the Anaconda folder, a command window flashes open and then closes. Below is the error I captured from the cmd window:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\cwp.py", line 9, in <module>
from menuinst.knownfolders import FOLDERID, get_folder_path, PathNotFoundException
ImportError: No module named menuinst.knownfolders
I am using Windows10 64bit.
Could someone kindly help?

Have you tried the following command in the cmd:
conda install menuinst
This should install the menuinst package, as you appear to not have it installed.

Related

Why cant I import/use installed libraries in Python

I recently downloaded Python 3.10 because I used 3.9. At first, everything worked fine. Sadly, I can't use installed libraries nor use newly downloaded ones, since I deleted Python 3.9. What can I do about this problem?
VSCode gives me this Error message:
Traceback (most recent call last):
File "e:\XXXX\XXXX.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
You can check installed packages using this command:
pip freeze
or
pip list
Uninstall and install using command pip install <package-name>

Can't run Jupiter Notebook on Mac m1

Just reinstalled Anaconda on my Mac m1, and now when I try and open Jupyter Notebook using the command line, it gives me this error:
jupyter notebook
Traceback (most recent call last):
File "/Users/alborzgharabaghi/opt/anaconda3/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/alborzgharabaghi/opt/anaconda3/lib/python3.8/site-packages/notebook/notebookapp.py", line 49, in <module>
from zmq.eventloop import ioloop
File "/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/__init__.py", line 57, in <module>
_load_libzmq()
File "/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/__init__.py", line 32, in _load_libzmq
from . import libzmq
ImportError: dlopen(/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so, 10): no suitable image found. Did find:
/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture
/Users/alborzgharabaghi/.local/lib/python3.8/site-packages/zmq/libzmq.cpython-38-darwin.so: mach-o, but wrong architecture
Any help would be appreciated.
The problem is coming from the pyzmq library!
Its non-M1 compatible version has probably been installed on your Mac.
You will need to reinstall it with a Rosetta Terminal.
Step 1: create a new Rosetta terminal, follow that tuto (or any other on the web)
Step 2: open your new Rosetta terminal and re-install pyzmq:
pip uninstall pyzmq
pip install pyzmq
I've been experiencing similar issues with this and other CLI commands with the M1. MacOS ships with an old version of Bash, updating Bash to v5 (and making sure I'm running commands in that environment) cleared up this error for me. This article helped: Upgrading Bash on MacOS

CNTK Crashes Python when imported : Fatal Python error: Py_Initialize: can't initialize sys standard streams

I have installed CNTK CPU only version module using pip
pip3 install https://cntk.ai/PythonWheel/CPU-Only/cntk-2.3.1-cp36-cp36m-win_amd64.whl
When i imported in spyder IDE, it was working fine. But when i tried to install other modules likes pandas, numpy using pip it crashes Python and says stopped working.
C:\Program Files\Python36\Scripts>pip3 install pandas
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "C:\Program Files\Python36\Lib\site-packages\cntk\io\__init__.py", line 1
3, in <module>
ModuleNotFoundError: No module named 'cntk'
It says There is no module names CNTK and crashes Python. I am unable to open Python IDE after this.
Any idea why this happens? I uninstalled and installed for nearly 4 times. It still a problem.

ImportError for perl in python terminal

I have Perl v5.10.1 installed on my CentOS 6 linux box. However, when I try to import perl in the python terminal, I get an ImportError.
>>>import perl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named perl
I had a similar issue earlier with Gnuplot, but that was resolved by simply installing another package.
ImportError for Gnuplot in python terminal
I cannot figure out what is wrong.
Please help. Thanks.
First you have to download pyperl package and then install it.
Download link http://www.felix-schwarz.name/files/opensource/pyperl/
Download the package
unzip it if it is zipped
open cmd and cd into the directory containing setup.py
type in python setup.py install

python scikit error - no module named sklearn

When i follow the website (https://www.kaggle.com/wiki/GettingStartedWithPythonForDataScience) and type python makeSubmission.py I get the following error message :
ImportError: No module named sklearn
I think I have already successfully installed the following:
Python 3.4 for windows
sciPy,NumPy and matplotlib
setuptools
scikit-learn
PyCharm
I then opened "Python 3.4 command line" and typed import sys; print(sys.__path__),but I got the message
Traceback (most recent call last): File "<stdin>", line 1, in <module>
AttributeError: module object has no attribute '__path__'
Anyone can help?
Looks like you haven't installed scikit-learn properly. pip install -U scikit-learn should do the job. Also, I would suggest downloading the Anaconda distribution of python if you're planning to use python for kaggle contests. It takes care of all the necessary dependencies and contains all the commonly needed python packages for the contest. I found that easier than the tedious download of the dependencies. Here's the Link
The Ubuntu 14.04 package is named python-sklearn (formerly python-scikits-learn) and can be installed using the following command:
sudo apt-get install python-sklearn
If you are using PyCharm or any other IDE, then you have to install 'sklearn' separately in PyCharm tool too. In My Case I am using PyCharm, select
File Menu-> Default Settings-> Project Interpreter -> Press + button and type 'sklearn'
Press install button. Installation will be done in 10 to 20 seconds.
2nd option is if you already installed 'sklearn' using terminal then you have to set path in your PyCharm IDE.

Categories

Resources