I have a 2021 Macbook pro M1.
It is a well recognized problem that it conflicts with Tensoflow library, see here or here; in particular this last one was exactly the issue I experienced: when I tried to import tensorflow in jupyter notebook via the command
import tensorflow as tf
then the message
The kernel appears to have died. It will restart automatically.
appeared. Then searching in the above linked discussions, I have the feeling that the suggestion given at some point, which points at this link, SEEMS to be useful.
FIRST QUESTION: is this a/the solution for the M1-Tensorflow conflict?
I say "it seems" since before trying that I have been into the kind of tornado of desperate attempts leading a beginner like me to search for hints all around the web and then copy-paste commands taken here and there into the Terminal without understanding them all properly.
On one hand it sounds dumb, I admit, on the other the cost of understanding everything goes well beyond my humble intentions of learning some ML.
So, the final result is that I have a complete mess in my computer; the old libraries like numpy don't work anymore (when I import them inside a Python3 page opened with jupyter notebook with the command import numpy as np, the message
ModuleNotFoundError: No module named 'numpy'
appears), then the pip command doesn't work, if I use the pip3 to install, nothing changes. I read somewhere to use a virtual enviroment, and I followed the instructions even if I wasn't really aware of what I was doing; I downloaded XCode, miniforge3...
Well, I guess that there is somebody out there who can relate with this.
SECOND PROBLEM: I would like to clean-up everything dealing with Python/pip/anaconda and so on and install everything from scratch, possibly following the above link to solve the M1-tensorflow conflict...if it is correct. How can I do that?
Can somebody help me, please? Thanks
I use Python data science libraries like Pandas, Matplotlib, Numpy. I like working with these. And for ease of use, I also have Anaconda installed which makes creating environments a breeze. But today when running some matplotlib code I face a really weird issue that I didn't encounter ever before. This issue occurs right when I try to import Pyplot.
$ python
>>> import matplotlib.pyplot as plt
!▓KH═⌐-▌ª╚E├╚Hü⌠>┴┘UÜWF♀ε½░±-Sz;½¼öC¿Æ→$√
)ì⌠┐→⌐V¿U!└φÑ^~π┘╠⌡╗♦{ò►ßq╢ê<_│☺♀àV╣oY}ër╡╫╞╟lBîyû,πƒ=♂▒-Öδbùh♂RΣ}Ω¼╘zâ╫♫┘▀\φ→H
$Æ⌡«ε╖#{╤╧↕ƒÅ▄\.╔~s)╥τ♣E:,-Ut⌠↓R↑J¬τpg┐±`&╟╡▓ ▓û
TS1Å`a↑╚+╬╚?└D¿e£▀z¼i♥☼·s&⌐
When I try to import Pyplot I hear three dots (like morse code) and then this gibberish comes up and my program ends. I have never seen anything like this before.
It didn't give me any ModuleNotFoundError or any sort of errors at all. The program just literally stops and the gibberish is printed. I have copied exactly what gets printed.
I have encountered this issue with Matplotlib and also NLTK. Trying to import NLTK shows the same error. I don't know if this issue occurs with any other library but I can confirm it occurs with Matplotlib and NLTK.
I was thinking about re-installing Anaconda but was curious to know more about this really weird issue. I would also like to say that the issue is with my base (root) conda environment, NLTK doesn't have any issues in my other machine-learning environment. Any help is absolutely appreciated.
Pycharm is giving me a
AttributeError: module 'http' has no attribute 'client'
when trying to load in pandas for a specific file. Strangely I only get this error if I also have the following import:
from sklearn import svm
pandas is with the Anaconda package suite, and runs/loads without the sklearn module, and in the console.
Python 3.7, Github extension, anaconda suite. I have tried reinstall pandas and sklearn to no avail. I have tried reordering my file structure to avoid python path issues.
python
import pandas
from sklearn import svm
I expect the code to compile as there are no noticeable syntax errors and even with the rest of the code commented out this still happens.
edit: it compiles when run in the console, so there appears to be an issue with the python path. Is there a way to investigate this more closely or directly control the python path? Also it compiles when I run with
import sklearn
but does not with
from sklearn import svm
if that helps narrow down the issue at all...
The problem appears to be that my file is named ssl.py I don't know if there's another file called that which was cauing path issues but it seems to be fixed now...
I want to create neural network and install scipy and PyBrain for it.
On file i write:
from pybrain.tools.shortcuts import buildNetwork
net=buildNetwork(4,2,1)
and when i run that file, an error occured
from scipy.linalq import inv,det, svd, logm, expm2
ImportError: cannot import name expm2
Can you advise something?
Scipy latest version doesn't contain scipy.linalg.expm2. Instead, it has scipy.linalg._expm_frechet. So open up that .py file in Pybrain (pybrain.tools.functions) and replace the line from scipy.linalg import inv, det, svd, logm, expm2 with from scipy.linalg import inv, det, svd, logm, _expm_frechet and it should solve your problem.
This error message is basically saying:
expm2 isn't installed. i.e. Your scipy version hasn't got expm2 or something went wrong during the installation.
Try reinstalling scipy, that should do it.
The function scipy.linalg.expm2 used by PyBrain has been deprecated since v.0.13 and has been removed in v.1.0.0 (not yet released):
The deprecated functions expm2 and expm3 have been removed from
scipy.linalg.
(In section "Backwards incompatible changes")
As it seems that PyBrain has not been updated yet, you need to fall back to a Scipy version that still contains this function, such as the last release v.0.19.1.
I had the same error. I don't know if it is still relevant, but for me the error dissapeared when I changed expm2 to expm.
Just to make things easier for everyone out there trying this solution:
in the python console after installing the pybrain library, type pybrain.tools.functions as the attached figure is showing up
after the word "from" between simple quotes is your file path for the .py functions file used as show on the figure
File path shown on the python console
open it up and press CTRL + F to search for the expm2 reference in the import statement amongst the first lines of code in the file
on the import statement for expm2, replace expm2 for _expm_frechet as shown on the figure
Replacement of expm2 for _exp_frechet
now, try running your code again and jupyter lab should work with the pybrain library
To solve this problem u can do it:
Find the file "functions.py" in
"C:\Users<user-name>\AppData\Local\Programs\Python\Python310\Lib\site-packages\pybrain\tools"
Find this command "from scipy.linalg import", and then change "expm2" to "expm", do it in this function too "def sqrtm(M)":
"expm2(0.5 * logm(M)" to "expm(0.5 * logm(M)".
I don't have a lot of programming experience, so please try to keep answers relatively noob-friendly! :) Basically, I have a Python...library, I guess? or module? that I need to run in Spyder through Anaconda. This seems to be a very obscure module called PySPM, used for analyzing scanning probe microscopy data, that I received from a colleague my lab collaborates with. When I try to run a piece of software which uses this module, it gives this error:
ImportError: No module named 'PySPM.io'
The code itself which triggers this reads as follows:
from os import path
from PySPM.io.Translators.Utils import uiGetFile
from PySPM.io.Translators.BEPSndfTranslator import BEPSndfTranslator
from PySPM.io.Translators.BEodfTranslator import BEodfTranslator
from PySPM.analysis.BESHOFitter import BESHOFitter
The first line that says from PySPM.io.Translators.Utils import uiGetFile is what's triggering the error. I'm really stuck scratching my head here. What's going on and how can I solve it?
Pycroscopy is the (thoroughly) reorganized version of PySPM.
#Martensite try:
$ pip install pycroscopy