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

When creating venv: No such file or directory: pyvenv.cfg #3814

Closed
jobevers opened this issue Mar 20, 2021 · 2 comments
Closed

When creating venv: No such file or directory: pyvenv.cfg #3814

jobevers opened this issue Mar 20, 2021 · 2 comments
Labels
kind/bug Something isn't working as expected

Comments

@jobevers
Copy link

jobevers commented Mar 20, 2021

  • [x ] I am on the latest Poetry version.

  • [ x] I have searched the issues of this repo and believe that this is not a duplicate.

  • [x ] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Windows 10

  • Poetry version: Poetry version 1.1.5

> poetry env use C:\Users\jobevers\AppData\Local\Microsoft\WindowsApps\python3.8.exe -vvv
Creating virtualenv classifier-JLG4GwH_-py3.8 in C:\Users\jobevers\AppData\Local\pypoetry\Cache\virtualenvs

  Stack trace:

  18  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\clikit\console_application.py:131 in run
       129│             parsed_args = resolved_command.args
       130│
     → 131│             status_code = command.handle(parsed_args, io)
       132│         except KeyboardInterrupt:
       133│             status_code = 1

  17  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\clikit\api\command\command.py:120 in handle
       118│     def handle(self, args, io):  # type: (Args, IO) -> int
       119│         try:
     → 120│             status_code = self._do_handle(args, io)
       121│         except KeyboardInterrupt:
       122│             if io.is_debug():

  16  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\clikit\api\command\command.py:171 in _do_handle
       169│         handler_method = self._config.handler_method
       170│
     → 171│         return getattr(handler, handler_method)(args, io, self)
       172│
       173│     def __repr__(self):  # type: () -> str

  15  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\cleo\commands\command.py:92 in wrap_handle
        90│         self._command = command
        91│
     →  92│         return self.handle()
        93│
        94│     def handle(self):  # type: () -> Optional[int]

  14  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\poetry\console\commands\env\use.py:23 in handle
       21│             return
       22│
     → 23│         env = manager.activate(self.argument("python"), self._io)
       24│
       25│         self.line("Using virtualenv: {}".format(env.path))

  13  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:400 in activate
        398│                     create = True
        399│
     →  400│             self.create_venv(io, executable=python, force=create)
        401│
        402│         # Activate

  12  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:761 in create_venv
        759│             )
        760│
     →  761│             self.build_venv(venv, executable=executable)
        762│         else:
        763│             if force:

  11  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:808 in build_venv
        806│                 "--python",
        807│                 executable or sys.executable,
     →  808│                 str(path),
        809│             ]
        810│         )

  10  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\run\__init__.py:32 in cli_run
        30│     of_session = session_via_cli(args, options, setup_logging, env)
        31│     with of_session:
     →  32│         of_session.run()
        33│     return of_session
        34│

   9  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\run\session.py:46 in run
       44│
       45│     def run(self):
     → 46│         self._create()
       47│         self._seed()
       48│         self._activate()

   8  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\run\session.py:53 in _create
       51│     def _create(self):
       52│         logging.info("create virtual environment via %s", ensure_text(str(self.creator)))
     → 53│         self.creator.run()
       54│         logging.debug(_DEBUG_MARKER)
       55│         logging.debug("%s", _Debug(self.creator))

   7  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\create\creator.py:172 in run
       170│             safe_delete(self.dest)
       171│         self.create()
     → 172│         self.set_pyenv_cfg()
       173│         if not self.no_vcs_ignore:
       174│             self.setup_ignore_vcs()

   6  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\create\via_global_ref\venv.py:73 in set_pyenv_cfg
       71│     def set_pyenv_cfg(self):
       72│         # prefer venv options over ours, but keep our extra
     → 73│         venv_content = copy(self.pyenv_cfg.refresh())
       74│         super(Venv, self).set_pyenv_cfg()
       75│         self.pyenv_cfg.update(venv_content)

   5  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\create\pyenv_cfg.py:44 in refresh
       42│
       43│     def refresh(self):
     → 44│         self.content = self._read_values(self.path)
       45│         return self.content
       46│

   4  c:\users\jobevers\.local\pipx\venvs\poetry\lib\site-packages\virtualenv\create\pyenv_cfg.py:26 in _read_values
       24│     def _read_values(path):
       25│         content = OrderedDict()
     → 26│         for line in path.read_text(encoding="utf-8").splitlines():
       27│             equals_at = line.index("=")
       28│             key = line[:equals_at].strip()

   3  c:\users\jobevers\appdata\local\programs\python\python36\lib\pathlib.py:1196 in read_text
       1194│         Open the file in text mode, read it, and close the file.
       1195│         """
     → 1196│         with self.open(mode='r', encoding=encoding, errors=errors) as f:
       1197│             return f.read()
       1198│

   2  c:\users\jobevers\appdata\local\programs\python\python36\lib\pathlib.py:1183 in open
       1181│             self._raise_closed()
       1182│         return io.open(str(self), mode, buffering, encoding, errors, newline,
     → 1183│                        opener=self._opener)
       1184│
       1185│     def read_bytes(self):

   1  c:\users\jobevers\appdata\local\programs\python\python36\lib\pathlib.py:1037 in _opener
       1035│     def _opener(self, name, flags, mode=0o666):
       1036│         # A stub for the opener argument to built-in open()
     → 1037│         return self._accessor.open(self, flags, mode)
       1038│
       1039│     def _raw_open(self, flags, mode=0o777):

  FileNotFoundError

  [Errno 2] No such file or directory: 'C:\\Users\\jobevers\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\classifier-JLG4GwH_-py3.8\\pyvenv.cfg'

  at c:\users\jobevers\appdata\local\programs\python\python36\lib\pathlib.py:387 in wrapped
       383│
       384│     def _wrap_strfunc(strfunc):
       385│         @functools.wraps(strfunc)
       386│         def wrapped(pathobj, *args):
    →  387│             return strfunc(str(pathobj), *args)
       388│         return staticmethod(wrapped)
       389│
       390│     def _wrap_binary_strfunc(strfunc):
       391│         @functools.wraps(strfunc)
@jobevers jobevers added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 20, 2021
@finswimmer
Copy link
Member

Hello @jobevers,

this is fixed in master by #5931 and will be available with the next 1.2 release.

fin swimmer

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jul 31, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants