0

In my current project I'm using conda environment with following content.

environment.yml

dependencies:
  - python 3.7.*
  - setuptools 49.1
  - pip
  - pip:
      - poetry
      - toml
      - .

But when I'm running the command to create environment: conda env create -q -p .condavenv -f environment.yml it raising following error:

Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Installing pip dependencies: ...working... Pip subprocess error:
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
  ERROR: Command errored out with exit status 1:
   command: /Users/user/work/simple-python/.condavenv/bin/python /Users/user/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/tmpvvaby14f
       cwd: /private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-req-build-kxpaykdf
  Complete output (18 lines):
  Traceback (most recent call last):
    File "/Users/user/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
      main()
    File "/Users/user/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/user/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-build-env-mgccste_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 155, in get_requires_for_build_wheel
      config_settings, requirements=['wheel'])
    File "/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-build-env-mgccste_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-build-env-mgccste_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 259, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/private/var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/pip-build-env-mgccste_/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 2, in <module>
      import toml
  ModuleNotFoundError: No module named 'toml'
  ----------------------------------------
WARNING: Discarding file:///Users/user/work/simple-python. Command errored out with exit status 1: /Users/user/work/simple-python/.condavenv/bin/python /Users/user/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/tmpvvaby14f Check the logs for full command output.
ERROR: Command errored out with exit status 1: /Users/username/work/simple-python/.condavenv/bin/python /Users/username/work/simple-python/.condavenv/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/kq/3kr8fjgx6fv272mmnglm4lph_wfb11/T/tmpvvaby14f Check the logs for full command output.

failed

CondaEnvException: Pip failed

This is the content of setup.py, which utilize the poetry.

setup.py

from setuptools import setup
import toml

with open("pyproject.toml") as pyproject_f:
    pyproject = toml.load(pyproject_f)

name = pyproject["tool"]["poetry"]["name"]
version = pyproject["tool"]["poetry"]["version"]

setup(name=name, version=version)

And then the content of poetry configuration

pyproject.toml

[tool.poetry]
name = "test"
version = "0.0.1"
description = "DevOps example - simple python package."
authors = ["chaotic <chaotic@mail.com>"]
packages = [
    { include = "src" }
]

[[tool.poetry.source]]
name = "artifactory"
url = "https://xxx.xx.x/artifactory/api/pypi/pypi-main/simple"
default = true

This is what I inherited from my excolleague. My plan is definitely get rid of poetry completely, utilize just standard setup.py with conda, but without . symbol of the end of file, because without the . the conda env installation just works fine.

UPDATE: I've got an answer from @sinoroc - thanks for that, because I even didn't know what the . symbol in the end of environment.yml file means.

chaotic
  • 391
  • 3
  • 6
  • 19
  • 1
    A single dot `.` usually means the current working directory. In this case, I guess it would mean pip should install the project in the current directory. – sinoroc May 20 '21 at 20:46

0 Answers0