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
Related
PS D:\projects\fashion-recommender-system> streamlit run main1.py
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://192.168.1.213:8501
2022-05-04 14:12:41.903 Traceback (most recent call last):
File "C:\Users\prana\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\streamlit\scriptrunner\script_runner.py", line 443, in run_script
exec(code, module.dict)
File "D:\projects\fashion-recommender-system\main1.py", line 1, in
import tensorflow
File "C:\Users\prana\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tensorflow_init.py", line 37, in
from tensorflow.python.tools import module_util as _module_util
ModuleNotFoundError: No module named 'tensorflow.python'
above is the output of terminal.
tensorflow is installed in python and does work when I run python file, but when I run the python file using streamlit run main.py, It doesn't find any tensorflow module.
I have installed python versions of 3.9 and 3.7
In 3.7 python shell when I import tensorflow, there is no error
In 3.9 python shell when I import tensorflow there is error
when I run pip --version command it gives me this warning
pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 22.0.4 from C:\Users\prana\AppData\Roaming\Python\Python37\site-packages\pip (python 3.7)
I don't know what is causing streamlit to not found tensorflow module, please help me.
I installed tensorflow using this link on StackOverflow.
But, when I tried to run my code, I got the error below
This is my system's information
(env) PS C:\SD\project> python --version
Python 3.7.3
(env) PS C:\SD\AnomalyDetectionCVPR2018> pip3 --version
pip 19.1.1 from c:\sd\env\lib\site-packages\pip (python 3.7)
The error that I got:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\SD\env\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\SD\env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\SD\env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
What am I doing wrong? So far I've used Python and pip with no issues.
again, I had the same problems that you have now, I tryed install tensorflow in windows7, windows 8 and 10 inclusive in virtual machinnes, the same problem was for matplotlib.
My solution was remove my python version and I installed Anaconda,
Try to install Anaconda3-4.4.0-Windows-x86_64 or Anaconda3-4.4.0-Linux-x86_64.sh for linux, this version was released in 2017-05-26.
Anacoda versions
And then try to install tensorflow, matplotlib, pandas, numpy but before run
conda update conda
To update some packages of anaconda. And you will install those the packages/libraries without problems,
Best Regards
I've used the following tutorial to install Python, numpy, scipy and matplotlib:
https://penandpants.com/2012/03/01/install-python-2/
I downloaded each and installed by double-clicking. I'm using a Mac with OS X Yosemite Version 10.10.5
When I try to import numpy, scipy and matplotlib in IDLE I get the follow error message:
`>>> import numpy
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper`
Can anyone please explain to me how to resolve this?
Thanks
use terminal and type
sudo pip install numpy
sudo pip install matplotlib
sudo pip install scipy
for python3+ use pip3
I can't say for sure what's wrong with your installation, but I suspect it's due to a some PATH-conusion... Python 2.7 and Numpy should be installed on your Mac by default.
If you run the command which python, you'll see which executable the python-commands invokes... is it the same as the one you installed?
If you write python in the terminal, and press tab twice, do you see multiple options of installed python versions?
Alternative method of installation
I prefer the Anaconda Python Distribution, which you can download like the full version or minimal version, which is the one I prefer.
If you install this, you should consider uninstalling the one you just installed.
Here's how to install the mini version:
Download the installer, and run it by opening a terminal in the folder with the installer, and running the command bash Miniconda2-latest-MacOSX-x86_64.sh. This will start the text-based installer, and if you read the instructions on screen, you'll be fine.
Notice that you have to scroll to the end of the licence agreement, before you can write yes when asked to accept the terms stated.
Say yes when it asked you if you'd like it to add Anaconda Python to your path.
Anaconda Python is different from other python distributions in the regard that it comes with it's own package and environment manager conda. With conda you can have multiple versions of Python installed at the same time (or several environments of the same Python version, but with different packages or versions of packages).
To create a new environment with the name py27, which is using Python 2.7, write conda create -n py27 python=2.7 --yes. Once created, activate the environment by source activate py27.
With the new environment now active, install the packages you need by using conda: conda install scipy matplotlib --yes.
I'd also recommend installing Ipython, which is an improved shell, and possibly the Jupyter notebook: conda install ipython --yes and conda install notebook --yes.
Hope it helps.
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.
After an update of OS X Yosemite 10.10.5 my Python install has blown up. I am not using brew, macports, conda or EPD, here, but a native Python build. While it was perfectly functional before, now it seems to have lost track of the installed packages. I try to start an ipython session and it returns
$ ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython", line 7, in <module>
from IPython import start_ipython
ImportError: No module named IPython
Then I resort to checking whether I can re-install ipython but my pip also went missing:
$ sudo pip install ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
So may it be that pip disappeared?
$ sudo easy_install install pip
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I have tried solutions to this last problem reported before but they do not seem to work.
So it seems that Python has lost track of itself. Anyone, clues of what may have gone wrong and how can I fix this? Thanks!
It is not quite clear what you mean by saying that you installed "a native Python build". But in any case, it seems you wrote files of your installation into the system directory" /System/..., which is not a good thing to do, since these are controlled by OSX and e.g. may be overwritten by a system update.
Apparently, that is then what happened. You updated OSX, it clobbered your changes to /System/... and thereby messed up your Python installation.
Note that AFAIK, with OSX 10.11 it will no longer even be possible to write into system directories, so you will need a different setup anyway.
A suggestion to avoid/fix this is simple: Use one of the standard ways to install your Python stack -- my personal recommendation is either macports or anaconda.