Giter Site home page Giter Site logo

Test on Windows about unidep HOT 9 CLOSED

basnijholt avatar basnijholt commented on June 16, 2024
Test on Windows

from unidep.

Comments (9)

ArneBachmannDLR avatar ArneBachmannDLR commented on June 16, 2024

I installed unidep with pipx and run unidep conda on a project of mine:

Traceback (most recent call last):
  File "C:\ProgramData\mambaforge_22.9.0.2\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\ProgramData\mambaforge_22.9.0.2\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\users\bach_ar\.local\bin\unidep.exe\__main__.py", line 7, in <module>
  File "C:\Users\bach_ar\.local\pipx\venvs\unidep\lib\site-packages\unidep\_cli.py", line 889, in main
    requirements = parse_requirements(
  File "C:\Users\bach_ar\.local\pipx\venvs\unidep\lib\site-packages\unidep\_dependencies_parsing.py", line 245, in parse_requirements
    specs = _parse_dependency(
  File "C:\Users\bach_ar\.local\pipx\venvs\unidep\lib\site-packages\unidep\_dependencies_parsing.py", line 120, in _parse_dependency
    _extract_first_comment(dependencies, index_or_key)
  File "C:\Users\bach_ar\.local\pipx\venvs\unidep\lib\site-packages\unidep\_dependencies_parsing.py", line 85, in _extract_first_comment
    comment_strings = next(
StopIteration

Maybe the parser doesn't like my environment.yaml?

Also unidep should support environment.yml naming as well.

from unidep.

basnijholt avatar basnijholt commented on June 16, 2024

Thanks for reporting @ArneBachmannDLR! Would you be able to share that environment.yaml file? That would make it much easier to debug.

from unidep.

basnijholt avatar basnijholt commented on June 16, 2024

I strongly suspect it is because of some comment structure that I didn't account for.

from unidep.

ArneBachmannDLR avatar ArneBachmannDLR commented on June 16, 2024

Yes, that was my thought as well. I use comments generously, even inside lists etc.. This is a pure conda file:

# Requirements file for CI/CD
name: test-redacted-3-x

dependencies:  # these include requirements.txt and requirements-all.txt, but not requirements-dev.txt
- certifi>=2023
- python-graphviz>=0.20.1  # WARN: do not use graphviz package, use python-graphviz or pip install graphviz (which requires compilation)
- lxml>=4.6.3
- oscrypto>=1.3
- psutil>=5.9.5
- ruamel.yaml>=0.17.33
- questionary>=2.0.1
- requests>=2.31
- strictyaml>=1.7.3
# Docs
- mkdocs
- mkdocstrings[python]  # if missing, you get ModuleNotFoundError: No module named 'mkdocstrings_handlers', or ModuleNotFoundError: No module named 'mkdocstrings.handlers.python'
- mkdocs-material  # if missing, you get TypeError: string indices must be integers, not 'str'
# Build
- hatch
- pip
- pip:  # these dependencies are never automatically updated by conda/mamba after initial setup (I think)
  -  'beartype>=0.16'  # includes Self and LiteralString
  -  comtypes
  -  frozendict
  -  frozenlist2
  -  keyring; sys_platform=='win32'
  -  git_of_theseus  # code graphs
  -  oscrypto
  -  requests_kerberos
  # -'ruamel.yaml >="0.17.21"; python_version>="3.10"'
  -  setproctitle
  - 'pywin32 == 301; python_version< "3.10"'  # was win32 before - unsure if this is correct
  - 'pywin32 >= 302; python_version>="3.10"'
  - "tomli; python_version<'3.11'"
  -  tomli-w
  -  typing_extensions
  - "winshell >= 0.6"  # only as pip package
  - logsetup>=1.202401
  # Copy from requirements-dev.txt:
  - coverage
  - lxml-stubs
  - mkdocs
  - mkdocs-material
  - mkdocstrings[python]
  - mypy>=1.7
  - perflint
  - pycln  # identify unnecessary imports
  - pymdown-extensions
  - refurb; python_version>='3.10'
  - ruff  # also available as conda package
  - twine
  - types-certifi
  - types-requests
  - types-psutil
  - types-pywin32

from unidep.

basnijholt avatar basnijholt commented on June 16, 2024

@ArneBachmannDLR, the root of the problem is that unidep has its own requirements.yaml file format. I took the time to convert your file to requirements.yaml:

# Requirements file for CI/CD
name: test-redacted-3-x

dependencies: # these include requirements.txt and requirements-all.txt, but not requirements-dev.txt
  - certifi >=2023
  - pip: graphviz >=0.20.1
    conda: python-graphviz >=0.20.1
  - lxml >=4.6.3
  - pip: oscrypto >=1.3
  - psutil >=5.9.5
  - ruamel.yaml >=0.17.33
  - questionary >=2.0.1
  - requests >=2.31
  - strictyaml >=1.7.3
  # Docs
  - mkdocs
  - pip: mkdocstrings[python] # if missing, you get ModuleNotFoundError: No module named 'mkdocstrings_handlers', or ModuleNotFoundError: No module named 'mkdocstrings.handlers.python'
  - mkdocs-material # if missing, you get TypeError: string indices must be integers, not 'str'
  # Build
  - hatch
  - pip
  - beartype >=0.16 # includes Self and LiteralString
  - pip: comtypes
  - frozendict
  - pip: frozenlist2
  - keyring  # [win]
  - pip: git_of_theseus # code graphs
  - requests-kerberos
  # -'ruamel.yaml >="0.17.21"; python_version>="3.10"'
  - setproctitle
  - conda: pywin32
  - pip: "tomli; python_version<'3.11'"
  - tomli-w
  - typing_extensions
  - pip: winshell >=0.6
  - pip: logsetup >=1.202401
  # Copy from requirements-dev.txt:
  - coverage
  - lxml-stubs
  - mkdocs
  - mkdocs-material
  - mypy >=1.7
  - pip: perflint
  - pycln # identify unnecessary imports
  - pymdown-extensions
  - pip: refurb; python_version>='3.10'
  - ruff
  - twine
  - types-certifi
  - types-requests
  - types-psutil
  - types-pywin32
channels:
  - conda-forge

Running unidep install . or unidep install requirements.yaml works on my end.

I did notice one issue (#137) that I have solved (unidep didn't allow for a . in package names). I have now released v0.46.0, which fixes this.

from unidep.

ArneBachmannDLR avatar ArneBachmannDLR commented on June 16, 2024

Thanks for the support! I'm still having trouble getting things running.

  • unidep doesn't consider the configured environment name test-redacted-3-x (doesn't automatically create an environment under that name) - but neither mamba seems to be able to parse it (anymore?)
  • I installed unidep via pipx to have universally available - but it fails when it tries to install into the write-protected global/base environment instead of the currently activated one
  • when installing the unidep tool into an activated environment, then it works -> but that defeats the purpose?
  • unidep conda still fails, as does unidep pip with a comment parsing error and StopIteration
  • mamba install --file requirements.yaml fails with `CondaValueError: could not parse '- 'certifi>=2023'' in: requirements.yaml

from unidep.

basnijholt avatar basnijholt commented on June 16, 2024

Sorry for the delay in getting back to you.

unidep doesn't consider the configured environment name test-redacted-3-x (doesn't automatically create an environment under that name) - but neither mamba seems to be able to parse it (anymore?)

That is correct, the name is currently not used for anything. Did you expect it would generate a new environment with that name?

I installed unidep via pipx to have universally available - but it fails when it tries to install into the write-protected global/base environment instead of the currently activated one
when installing the unidep tool into an activated environment, then it works -> but that defeats the purpose?

If you install the latest version (0.49.1), this is now possible. You made a good point.

unidep conda still fails, as does unidep pip with a comment parsing error and StopIteration
mamba install --file requirements.yaml fails with `CondaValueError: could not parse '- 'certifi>=2023'' in: requirements.yaml

These problems were likely Windows related and I have fixed them in the latest version. UniDep is now fully tested on Windows too.

from unidep.

ArneBachmannDLR avatar ArneBachmannDLR commented on June 16, 2024

unidep conda and unidep pip work now with the file you converted. Thanks!

The pipx issue remains (should install into currently active environment):

(311) D:\forks\HACE\autocook>unidep install
usage: unidep install [-h] [-v] [-e] [--skip-local] [--skip-pip] [--skip-conda] [--skip-dependency SKIP_DEPENDENCY] [--no-dependencies] [--conda-executable {conda,mamba,micromamba}] [--conda-env-name CONDA_ENV_NAME | --conda-env-prefix CONDA_ENV_PREFIX] [--dry-run]
                      [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN]
                      files [files ...]
unidep install: error: the following arguments are required: files

(311) D:\forks\HACE\autocook>unidep install requirements.yaml
---------------------
⚠️  *** WARNING *** ⚠️
UniDep should be run from the current Conda environment for correct operation. However, it's currently running with the Python interpreter at `C:\Users\bach_ar\.local\pipx\venvs\unidep\Scripts\python.exe`, which is not in the active Conda environment (`C:\Users\bach_ar\.conda\envs\311`). Please install and run UniDep in the current Conda environment to avoid any issues, or provide the `--conda-env-name` or `--conda-env-prefix` option to specify the Conda environment to use.
Location: C:\Users\bach_ar\.local\pipx\venvs\unidep\lib\site-packages\unidep\_cli.py:1033
---------------------

I will address the other issues individually.
Cheers!

from unidep.

basnijholt avatar basnijholt commented on June 16, 2024

Will close this issue and continue in #144

from unidep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.