Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should check user input when init project. #89

Closed
1 task done
Aloxaf opened this issue Mar 27, 2020 · 3 comments · Fixed by #91
Closed
1 task done

Should check user input when init project. #89

Aloxaf opened this issue Mar 27, 2020 · 3 comments · Fixed by #91
Labels
🐛 bug Something isn't working

Comments

@Aloxaf
Copy link
Contributor

Aloxaf commented Mar 27, 2020

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

❯ pdm init -v
Creating a pyproject.toml for PDM...
Please enter the Python interpreter to use:
0. /usr/bin/python3 (3.8.2)
1. /usr/bin/python2 (2.7.17)
Please select: [0]: 0
Using Python interpreter: /usr/bin/python3 (3.8.2)
Project name [test]:
Project version [0.0.0]:
License(SPDX name) [MIT]:
Author name [Aloxaf]:
Author email [[email protected]]:
Python requires('*' to allow any) [>=3.8]: 3.6
Changes are written to pyproject.toml.
❯ pdm add python-telegram-bot -v
Adding packages to default dependencies: python-telegram-bot
Traceback (most recent call last):
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 663, in __init__
    parsed.add(Specifier(specifier))
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 111, in __init__
    raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
pip._vendor.packaging.specifiers.InvalidSpecifier: Invalid specifier: '3.6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aloxaf/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 68, in __call__
    return self.main(*args, **kwargs)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 100, in main
    raise err.with_traceback(traceback)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 96, in main
    f(options.project, options)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/commands/add.py", line 35, in handle
    actions.do_add(
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 136, in do_add
    resolved = do_lock(project, strategy, tracked_names, all_dependencies)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 47, in do_lock
    provider = project.get_provider(strategy, tracked_names)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 220, in get_provider
    repository = self.get_repository(cls=self.core.repository_class)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 209, in get_repository
    return cls(sources, self.environment)
  File "/usr/lib/python3.8/functools.py", line 966, in __get__
    val = self.func(instance)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 144, in environment
    return Environment(self)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/environment.py", line 85, in __init__
    self.python_requires = project.python_requires
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/project/core.py", line 148, in python_requires
    return PySpecSet(self.tool_settings.get("python_requires", ""))
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/specifiers.py", line 94, in __init__
    super().__init__(version_str)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 665, in __init__
    parsed.add(LegacySpecifier(specifier))
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pip/_vendor/packaging/specifiers.py", line 111, in __init__
    raise InvalidSpecifier("Invalid specifier: '{0}'".format(spec))
pip._vendor.packaging.specifiers.InvalidSpecifier: Invalid specifier: '3.6'

Actual behavior

Tell me "3.6" is an invalid specifier after init project.

Expected behavior

Tell me "3.6" is an invalid specifier when init project.

Environment Information

pdm version:

❯ pdm info && pdm info --env
Python Interpreter: /usr/bin/python3 (3.8.2)
Project Root:       /tmp/test
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.2",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.5.11-zen1-1-zen",
  "platform_system": "Linux",
  "platform_version": "#1 ZEN SMP PREEMPT Sun, 22 Mar 2020 16:33:18 +0000",
  "python_full_version": "3.8.2",
  "platform_python_implementaiton": "CPython",
  "python_version": "3.8",
  "sys_platform": "linux"
}
@Aloxaf Aloxaf added the 🐛 bug Something isn't working label Mar 27, 2020
@Aloxaf
Copy link
Contributor Author

Aloxaf commented Mar 27, 2020

Oh, there is still another bug.

❯ pdm add python-telegram-bot -v
Adding packages to default dependencies: python-telegram-bot
⠹ Resolved: decorator 4.4.2See /tmp/pdm-lock-_mj6r4jp.log for detailed debug log.
Traceback (most recent call last):
  File "/home/aloxaf/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 68, in __call__
    return self.main(*args, **kwargs)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 100, in main
    raise err.with_traceback(traceback)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/core.py", line 96, in main
    f(options.project, options)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/commands/add.py", line 35, in handle
    actions.do_add(
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 136, in do_add
    resolved = do_lock(project, strategy, tracked_names, all_dependencies)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/cli/actions.py", line 55, in do_lock
    mapping, dependencies, summaries = resolve(
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/__init__.py", line 119, in resolve
    state = resolver.resolve({k: reqs.values() for k, reqs in requirements.items()})
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 297, in resolve
    resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 248, in resolve
    self._pin_criteria()
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/resolvers.py", line 215, in _pin_criteria
    dependencies = self._p.get_dependencies(candidate)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/providers.py", line 127, in get_dependencies
    dependencies = super().get_dependencies(candidate)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/resolver/providers.py", line 48, in get_dependencies
    deps, requires_python, summary = self.repository.get_dependencies(candidate)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 61, in get_dependencies
    requirements, requires_python, summary = getter(candidate)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 27, in wrapper
    result = func(self, candidate)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/repositories.py", line 130, in _get_dependencies_from_metadata
    deps = candidate.get_dependencies_from_metadata()
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/candidates.py", line 183, in get_dependencies_from_metadata
    metadata = self.get_metadata()
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/candidates.py", line 138, in get_metadata
    built = self.environment.build(ireq, self.hashes, allow_all_wheels)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/models/environment.py", line 315, in build
    return builder.build(**kwargs)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/builders/wheel.py", line 37, in build
    return self._build_other(build_dir, **kwargs)
  File "/home/aloxaf/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/builders/wheel.py", line 56, in _build_other
    raise WheelBuildError(str(self.ireq))
pdm.exceptions.WheelBuildError: future>=0.16.0 from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz#sha256=b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d
❯ cat /tmp/pdm-lock-_mj6r4jp.log
========Start resolving requirements========
        python-telegram-bot
Package constraints:
        python-telegram-bot     <= __default__
Found candidate python-telegram-bot 12.4.2
========Ending round 0========
New pins:
        python-telegram-bot     12.4.2
Package constraints:
        certifi <= python-telegram-bot
Found candidate certifi 2019.11.28
Package constraints:
        cryptography    <= python-telegram-bot
Found candidate cryptography 2.8
Package constraints:
        decorator>=4.4.0        <= python-telegram-bot
Found candidate decorator 4.4.2
Command errored out with exit status 1:
 command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pdm-buildtkdqao3m/future/setup.py'"'"'; __file__='"'"'/tmp/pdm-buildtkdqao3m/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-w_2dfs7s
     cwd: /tmp/pdm-buildtkdqao3m/future/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for future

@frostming
Copy link
Collaborator

@Aloxaf The second one is a known issue, you need to install wheel into the python you picked, would you mind file another issue to track it?

@Aloxaf
Copy link
Contributor Author

Aloxaf commented Mar 27, 2020

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants