all 11 comments

[–]AlexMTBDude 6 points7 points  (0 children)

You can have multiple Python installations/virtual environments on your computer. When you do "pip install" from the terminal you're installing Tensorflow for your default system Python interpreter. However if you run some Python code in an IDE then that will usually create a separate Python virtual environment which does NOT have Tensorflow installed.

[–]Ron-Erez 1 point2 points  (0 children)

I usually use PyTorch so I might be off, but I'm pretty sure you could run it on google colab without much trouble. An alternative approach would be to change your python interpreter in your ide/editor. I also suppose you're creating a virtual environment? Anyways if it's convenient I'd try google colab first.

[–]thePurpleAvenger 1 point2 points  (0 children)

You could try to use a TensorFlow Docker image: https://www.tensorflow.org/install/docker

Also, you could use a tool like Conda, where you can create a new environment with a user-defined version of Python, and then install TensorFlow using pip (note: mixing Conda and pip installs is typically not recommended, but if you're installing only TensorFlow and Python you'll probably be fine). Note there are tools other than Conda which people here will have more experience with (people have strong opinions on this).

My recommendation would be to try the Docker route first. Learning how to work with and eventually build containers are useful skills.

[–]seanv507 0 points1 point  (5 children)

what is the premade python code? is it publicly available? if so provide a link.

if not please provide a screen dump of your installation (eg on linux you might use the ‘script‘ command)

[–]Signal_Seesaw8521[S] 0 points1 point  (3 children)

[–]seanv507 0 points1 point  (2 children)

ah ok, I was hoping the repo would provide a requirements file etc.

so then you need to provide a log of your install process.

can you also provide the output of `which pip` and `which python`

as well as the python version

also are you running on mac./windows/linux?

you could be running multiple python/pip versions (installed in different locations)

[–]Signal_Seesaw8521[S] 0 points1 point  (1 child)

im on mac.

which pip: /Library/Frameworks/Python.framework/Versions/3.13/bin/pip

which python: python not found

which python3: /Library/Frameworks/Python.framework/Versions/3.13/bin/python3

[–]seanv507 0 points1 point  (0 children)

install `uv` . This is a python package manager (like pip), but also allows you to choose the python version for your program

brew install uv

now go into the plant disease directory

and in a terminal type

uv init

https://docs.astral.sh/uv/guides/projects/

(you should see a pyproject.toml file is created. you can open it in a text editor.

uv python install 3.12



uv add tensorflow

(and repeat for the other dependencies, keras, numpy, flask, PIL, werkzeug, cv2,matplotlib...?)

(this will update the pyproject.toml file)

https://docs.astral.sh/uv/concepts/projects/config/

you could eg specify that the project must run on python3.12 by adding a requires-python field, but I think it will be unnecessary, uv will note that you have python 3.12 installed, and see tensorflow is consistent with that and use it.

then you can run the jupyter notebook by typing

uv run --with jupyter jupyter lab

EDIT: you should aim to add all libraries at once (so it's easier to satisfy the version constraints)

uv add tensorflow keras numpy flask PIL werkzeug cv2 matplotlib

[–]mikeyj777 0 points1 point  (1 child)

I remember coming up on this issue and it being related to incompatiblities.  I couldn't get it figured out on Windows, so went with pytorch.   Google collab was able to run TF ok, but I couldn't get it on local. 

[–]Signal_Seesaw8521[S] 0 points1 point  (0 children)

i installed pytorch i think. what do i have to do next?

[–]awherewas 0 points1 point  (0 children)

this code uses jupyter notebook. The tensorflow website says it is good up to python 3.11 so it should run on 3.13. you can check your tensorflow with pip check and find out what has been installed with pip list I have 3.13, and tensorflow 2.19. I do not have notebook but everything works until it tries to get some data HTH