Reputation: 7004
I am using poetry with pyenv
to manage dependencies. My pyproject.toml
looks as follows:
[tool.poetry]
name = "hello-world"
version = "0.1.0"
description = "None"
authors = ["Hello <[email protected]>"]
readme = "README.md"
keywords = []
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
google-cloud = "^0.34.0"
google-cloud-core = "^2.3.2"
google-cloud-bigquery-datatransfer = "^3.7.1"
google-cloud-bigquery = "^3.3.2"
google-cloud-firestore = "^2.5.2"
[[tool.poetry.source]]
name = "ngt-pypi"
url = "link/to/private/package/abc-python/simple/"
default = false
secondary = true
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Assuming pyenv is installed (and using version 3.9.6), I install the dependencies by running:
poetry config virtualenvs.in-project true
poetry install
After this, I confirm that in my interpreter I have the latest versions of the google cloud repositories installed.
Nevertheless, when I try to create a code and import bigquery:
from google.cloud import bigquery
I see on the Pycharm editor that it has not been found. The code however does execute, and there are no errors. What can be done to resolve this issue?
Upvotes: 1
Views: 451
Reputation: 6572
For PyCharm
and IntelliJ
, you can do the following actions :
file/Project Structure
plus
buttonAdd Python sdk
Poetry environment
Poetry env
and create the sdk
in PyCharm
Project settings
section, select the sdk
created previouslyI usually use Pipenv
instead of Peoetry
but the principle is the same with PyCharm
.
Upvotes: 3