#๐ zsh: illegal hardware instruction python -c
253 messages ยท Page 1 of 1 (latest)
@summer quarry
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Following this tutorial :
Previously I ran the command : pip3 install --ignore-installed --upgrade tensorflow==2.5.0
Results : https://paste.pythondiscord.com/NQTQ
The command I ran right now resulting in this error was :
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
wait, u r in mac?
Python 3.8.8
what processor do u have?
The M1 is an ARM processor, not an x86 processor. It integrates more components than an Intel CPU. The Apple M1 also integrates RAM in the same package. It features Rosetta 2 dynamic binary translation that allows it to run x86 software.
just searched on google
can u run this and give me the output?
file $(which python3)
/opt/homebrew/bin/python3: Mach-O 64-bit executable arm64
ok, uninstall tensorflow in ur machine
alright
and install it using this
pip3 install tensorflow-macos
sure
just gimme a sec
also as part of the tutorial
i had also installed
protobuf
should i also uninstall that
hey
gostops
pip3 install tensorflow-macos
ERROR: Could not find a version that satisfies the requirement tensorflow-macos
ERROR: No matching distribution found for tensorflow-macos
just want to point out that you guys have mentioned two different executables:
- python
- python3
wait
so
should my command have just used python3 -c ...
it's up to you to figure out and track which interpreter you're using
.
when tensorflow says to run "pip" and "python" they don't actually mean that you should type that, they mean that you should run whichever ones of those you intend to do this with
python --version
and
python3 --version
Could help you figure out which versions you have
(base) xxx@iMac ~ % python --version
Python 3.8.8
(base) xxx@iMac ~ % python3 --version
Python 3.9.13
look at this
alr
you should probably not upgrade your python, as your python here probably means a system component that belongs to macos
rather, you would install another python that belongs to you
you *don't* replace stuff that belongs to the os
my python 3 version is above
3.9
could i install tensorflow using that
but how do i say that i want to use the python3 version
its just a pip install
i tried with pip3
python3 -m pip install
maybe?
or this, yeah
ok lemme just try
its working
nice
thanks!
im getting some erros
even though they finished
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.16.2 requires flatbuffers>=23.5.26, but you have flatbuffers 1.12 which is incompatible.
tensorflow 2.16.2 requires keras>=3.0.0, but you have keras 2.9.0 which is incompatible.
tensorflow 2.16.2 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3, but you have protobuf 3.19.6 which is incompatible.
tensorflow 2.16.2 requires tensorboard<2.17,>=2.16, but you have tensorboard 2.9.1 which is incompatible.
Successfully installed flatbuffers-1.12 keras-2.9.0 protobuf-3.19.6 tensorboard-2.9.1 tensorboard-data-server-0.6.1
and some Deprecations as well
I have no idea how to deal with that, sorry
for now, try creating a venv to install packages
and use that venv to run ur tensorflow code
wait what
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'reduce_sum'
ur global packages seems to be polluted
atleast it doesnt say illegal hardware
i already have a venv on my vscode
called
tensorflowenv
make sure you don't have a tensorflow.py
because if you do, then importing tensorflow would import your tensorflow.py rather than the library
how can i get into my venv
?
like in my terminal im just at base
and then i should do
python3 -m pip install tensorflow-macos?
i guess I will just do it in my vscode terminal
r u in ur venv rn?
if not, you can get into ur venv by running venv-name/Scripts/activate.exe
I imagine the activation file might not have .exe in the name
it's generally very difficult to tell you exactly what to run because it's your system so it's all relative to how you've set things up and if you don't get it running yourself it's easier to hand you an environment where everything is already set up
hey @fossil holly
s
i changed a few things
so
i created a new env
using conda
I fixed all my polluted libraries and upgraded them
but still
python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
zsh: illegal hardware instruction python3 -c
HOW
why is installation so hard
can you help me
pls
yea
in the venv right?
pip3 install tensorflow-macos==2.12.0
i did this
coz the errors mentioned
about this
should I have done python3 -m pip install tensorflow-macos instead?
u dont mention the version explicitly
yes
also, u said u have conda right?
do this too
conda install -c apple tensorflow-deps
surely one or the other, not both
ok
i already did the first
should I still do this one
this gh issue does talk about ur problem
depends on what is responsible for managing your packages. it's gonna be either conda or pip. don't frankenstein it
apparently this is only for verifying the installation
i created a conda env
and then pip installed
somebody in the github said
I'd recommend installing tensorflow-deps using conda first and then installing other stuff using pip.
conda install -c apple tensorflow-deps
pip install -r requirements.txt
requirements.txt containing:
tensorflow-macos
tensorflow-metal
jupyter
other packages
...
Thanks for all of your help anyways
does it work?
I really appreciate it
do u get ur issue resolved?
still loading
whats loading?
are u installing smth?
.
so, no errors so far?
nothings running
this is the same as last time when it gave that error
hopefully it doesnt this time
(tensorflow) xxx@iMac ObjectDetection % python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
its just liek this
bro its been like this for 2 mins
nothings happening
what should i do
@fossil holly is my program broken?
i think tasks like this in tf should take a lot of time depending on the machine
hm
bro
honestly
imma leave it
its just a verification
and i can do it later
but how do i stop it from running
coz
when i created a new terminal
my
tensorflow conda venv
was gona
gone
what?
no way
do u mena like u lost the venv folder or smth?
or u just got out of the venv session?
(tensorflowenv) (base) xxx@iMac ObjectDetection % deactivate
(base) xxx@iMac ObjectDetection %
this was the previous venv i had
i have no tensorflow folder
this is all that is there
when i used conda
idk if a new folder was even created to begin with
conda activate tensorflow
just have to do this command to reactivate it
but no folder is present
is that a problem @fossil holly ?
the env folder is still there
where
the "tensorflowenv" folder is a venv i created through python
the name of my conda env is "tensorflow"
and there is no folder fo it
this is a completely different one
thats the name of the module
doing so will make python to import that folder instead
bro look at the steps this tutorial gives
which one should I download @fossil holly
does your venv actually use the names pip3 and python3? I suspect they define pip and python in the activated environment, so are you even using the correct executables?
you've got at least three different environments.. four? you've got conda in there too. and I can't help but wonder if you're blindly copying/guessing instead of using *the. correct. one*
and here, did you simply give up on finding out whether this was installed? instead of running ALL of that at once, try importing it and seeing if the stuff is there or not
and if you're struggling with using a venv, install a trivial package instead to ensure that you're using the venv correctly before moving on to something far more complicated such as tensorflow (which in turn is probably not made easier by doing it on mac and on top of that on arm64)
if you can remote into something that has tensorflow installed for you already, that'd save you a whole bunch of trouble
having it locally is great and all but imo it's up to you to figure out your environment
I got it running on google colab in a few minutes. which mostly consisted of trying to figure out how to even get into colab
(no clue why I can run heavy stuff like that for free without any red tape whatsoever but I mean it's there)
i mean
im pretty sure tensorflow is installed
pretty sure?
what do u mean by using the names
well you could import it and look at it
and check if it says requirement already satisfied?
and again, if you're mixing up environments, start with a trivial package and get that running
thanks for the advice
will try
when you type python in zsh that's going to resolve into a file path to an executable, the name python can refer to anything
so when you type such a name, you need to ensure that's going to resolve to the thing you meant to run, and not something else
you could use the file path yourself, you could read the activation script for the venv to see what it does, or indeed you could run it and query it for who it is
it's not that it's hard, it's that things don't snap into place. the only one making things work or make sense is you
so everything needs to be deliberate from your end
(base) xxx@iMac research % protoc object_detection/protos/*.proto --python_out=.
zsh: killed protoc object_detection/protos/*.proto --python_out=.
and now I'm wondering if you're trying to run x86 executables again
what if you run your code here instead? https://colab.research.google.com/
looks like you can upload your files there. and tensorflow seems available. no clue what sort of performance is backing that though.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.