0

I'm using Python 3.8(64-bit)

Basically, I tried every possible solution on the internet like update the python version and tensorflow version etc.

But when I try to do this:

import tensorflow_quantum as tfq

terminal always say:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow_quantum'

Does anyone have any idea on this issue? Cheers

Jerry
  • 1
  • 2
  • 1
    Sorry if it is too stupid but did you install the package? `pip3 install -U tensorflow-quantum` – Cenk Bircanoglu Nov 12 '20 at 09:24
  • I have several suggestions, based on my slight research. It seems that either python 3.8 does not support TensorFlow quantum module, or installation instructions are not capable for later python (3.7+) versions. Check https://github.com/tensorflow/quantum/issues/213 – Harut Hunanyan Nov 12 '20 at 09:27
  • when I try to do this "pip3 install -U tensorflow-quantum", system shows: ERROR: Could not find a version that satisfies the requirement tensorflow-quantum (from versions: none) ERROR: No matching distribution found for tensorflow-quantum – Jerry Nov 12 '20 at 09:31
  • I remember they updated to support python 3.8 64bit – Jerry Nov 12 '20 at 09:32
  • As I see, it yet doesn't support tensorflow quantum, and it's a pity. You have better to dig deeper and find out exactly, but it seems that you have no option but downgrade your python to 3.6 or at least 3.7. Good luck – Harut Hunanyan Nov 12 '20 at 09:41

2 Answers2

0

Please run the following:

pip3 install --upgrade pip
pip3 install tensorflow==2.3.1
pip3 install -U tensorflow-quantum
dorialfa
  • 1
  • 2
  • Hi, for the first two, system shows:"Requirement already satisfied:" But for the third one, showing: ERROR: Could not find a version that satisfies the requirement tensorflow-quantum (from versions: none) ERROR: No matching distribution found for tensorflow-quantum – Jerry Nov 12 '20 at 09:30
0

I have faced quite a similar problem and I followed this link for some help

in short I created a virtual environment with

python version == 3.6.2
conda create -n your_new_env_name python=3.6.2 anaconda

and then activated this environment as follows before you continue

conda activate your_new_env_name

then installed tensorflow

pip install tensorflow==2.1.0
pip install tensorflow-gpu=2.0.0
pip install tensorflow-quantum

you may face 2 errors which you might need to be solved

the first is this When importing tensorflow, I get the following error:

No module named 'numpy.core._multiarray_umath'

all you have to do is this

pip install numpy --upgrade

or if needed

pip install numpy --upgrade --user

you may also get an error when import tensorflow-quantum that's related to google.api_core and what solved the problem for me was to do the following

pip install google.api_core==1.16.0

you may also need to the following

pip install cython

I hope it works!

Neuron
  • 5,141
  • 5
  • 38
  • 59
Ezz
  • 1
  • Hi there - just a tip, Stackoverflow is compatible with markdown syntax. Enclosing code blocks with "\`" makes them more readable. `An example.` – Stanley Jul 29 '21 at 16:44