Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

Poetry fails to install tensorflow

$
0
0

I've got a poetry project. My environment is Conda 22.9.0 on a windows machine with poetry version 1.2.2:

This is my pyproject.toml file:

[tool.poetry]name = "myproject"version = "0.1.0"description = ""[tool.poetry.dependencies]# REVIEW DEPENDENCIESpython = ">=3.7,<3.11"numpy = "*"tensorflow = "^2.8"[build-system]requires = ["poetry>=0.12"]build-backend = "poetry.masonry.api"[tool.poetry.scripts]start = "myproject.main:start"

The myproject\main.py module contains:

import tensorflow as tfdef start():    if tf.test.is_gpu_available():        print("TensorFlow is using a GPU.")    else:        print("TensorFlow is NOT using a GPU.")

If I do poetry install, it seems to work fine:

Creating virtualenv myproject in D:\Projects\myproject\dev\myproject-series-forecast\.venvUpdating dependenciesResolving dependencies...Writing lock filePackage operations: 41 installs, 0 updates, 0 removals• Installing certifi (2022.12.7)• Installing charset-normalizer (2.1.1)• Installing idna (3.4)• Installing pyasn1 (0.4.8)• Installing urllib3 (1.26.13)• Installing cachetools (5.2.0)• Installing oauthlib (3.2.2)• Installing rsa (4.9)• Installing six (1.16.0)• Installing zipp (3.11.0)• Installing requests (2.28.1)• Installing pyasn1-modules (0.2.8)• Installing google-auth (2.15.0)• Installing importlib-metadata (5.2.0)• Installing requests-oauthlib (1.3.1)• Installing markupsafe (2.1.1)• Installing absl-py (1.3.0)• Installing grpcio (1.51.1)• Installing numpy (1.21.6)• Installing tensorboard-data-server (0.6.1)• Installing markdown (3.4.1)• Installing tensorboard-plugin-wit (1.8.1)• Installing protobuf (3.19.6)• Installing werkzeug (2.2.2)• Installing google-auth-oauthlib (0.4.6)• Installing astunparse (1.6.3)• Installing flatbuffers (22.12.6)• Installing gast (0.4.0)• Installing google-pasta (0.2.0)• Installing h5py (3.7.0)• Installing keras (2.11.0)• Installing tensorflow-estimator (2.11.0)• Installing packaging (22.0)• Installing opt-einsum (3.3.0)• Installing libclang (14.0.6)• Installing tensorboard (2.11.0)• Installing tensorflow-io-gcs-filesystem (0.29.0)• Installing termcolor (2.1.1)• Installing typing-extensions (4.4.0)• Installing wrapt (1.14.1)• Installing tensorflow (2.11.0)Installing the current project: myproject (0.1.0)

But when executing poetry run start I got error in import

Traceback (most recent call last):File "<string>", line 1, in <module>File "D:\Python\Anaconda3\lib\importlib\__init__.py", line 127, in import_module    return _bootstrap._gcd_import(name[level:], package, level)File "<frozen importlib._bootstrap>", line 1030, in _gcd_importFile "<frozen importlib._bootstrap>", line 1007, in _find_and_loadFile "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 680, in _load_unlockedFile "<frozen importlib._bootstrap_external>", line 850, in exec_moduleFile "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removedFile "D:\Projects\myproject\dev\myproject-series-forecast\myproject\main.py", line 3, in <module>    import tensorflow as tfModuleNotFoundError: No module named 'tensorflow'

Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>