This is my first time setting up poetry. My project structure looks like this:
bert-api
bert_api
bert
__init__.py
predict.py
data
docs
tests
venv
poetry.lock
pyproject.toml
I created my poetry using following command:
curl -sSL https://raw.githubusercontent.com/python
#change python version
alias python='/usr/local/bin/python3.6'
python --version
#start a new project
poetry new bert-api
#open the project
poetry install
poetry shell
poetry env use /usr/local/bin/python3.6
now to run predict.py i go:
(venv) (base) a10.12@MacBook-Air bert-api % poetry install
(venv) (base) a10.12@MacBook-Air bert-api % poetry run script
and it works perfectly:
However as far as I know I suppose to use
poetry install
poetry shell
Spawning shell within /Users/a10.12/Library/Caches/pypoetry/virtualenvs/bert-api-w7KuvcmX-py3.6
a10.12@MacBook-Air bert-api % . /Users/a10.12/Library/Caches/pypoetry/virtualenvs/bert-api-w7KuvcmX-py3.6/bin/activate
and then run
poetry run script
but if I do this way I get an error:
ImportError: cannot import name 'VersionConstraint'
What am I doing wrong?
My pyproject.toml
[tool.poetry]
name = "bert-api"
version = "0.1.0"
description = ""
authors = [name]
[tool.poetry.dependencies]
python = "^3.6.7"
deeppavlov = "^0.15.0"
[tool.poetry.scripts]
script = "bert_api.bert.predict:main"
[tool.poetry.dev-dependencies]
pytest = "^5.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api
"