Skip to content

Using poetry with vagrant and having odd issues #4495

Closed

Description

@datacubed

I've tried installing via pip3 and curl with python3.

I keep running into a handful of odd behaviours:

If I install via pip3, it can never "find 'python' command" when running "poetry "

If I install with curl python3 it works, but when I run:
poetry add requests

I get "Failed to add packages, reverting the pyproject.toml file to its original content." - is this potentially something to do with vagrant sync_folders ?
I've had similar issues with ".lock"files when using npm.

However I can add "arrow=xxx" to my .toml file for example.
[tool.poetry.dependencies]
python = "^3.7"
arrow = "1.1.1"

Then I can run "poetry update", "poetry install" - no errors.
Also "poetry show" lists "arrow" in there.

But if I add "import arrow" to my poetry generated test_*.py file, then run "poetry run pytest", i get "no module arrow found".
Which I assume means poetry isn't installing my packages in the env?

I can only run "pytest" if I install it via pip3 too, which I assume is wrong?
If I uninstall it and run "poetry run pytest" I get :

Traceback (most recent call last):
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/vagrant/.poetry/lib/poetry/console/commands/run.py", line 30, in handle
    return self.env.execute(*args)
  File "/home/vagrant/.poetry/lib/poetry/utils/env.py", line 1375, in execute
    return super(VirtualEnv, self).execute(bin, *args, **kwargs)
  File "/home/vagrant/.poetry/lib/poetry/utils/env.py", line 1111, in execute
    return os.execvpe(bin, args, env=env)
  File "/usr/lib/python3.7/os.py", line 583, in execvpe
    _execvpe(file, args, env)
  File "/usr/lib/python3.7/os.py", line 616, in _execvpe
    raise last_exc
  File "/usr/lib/python3.7/os.py", line 607, in _execvpe
    exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory: b'/snap/bin/pytest'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vagrant/.poetry/bin/poetry", line 19, in <module>
    main()
  File "/home/vagrant/.poetry/lib/poetry/console/__init__.py", line 5, in main
    return Application().run()
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 142, in run
    trace.render(io, simple=isinstance(e, CliKitException))
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/exception_trace.py", line 232, in render
    return self._render_exception(io, self._exception)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/exception_trace.py", line 269, in _render_exception
    self._render_snippet(io, current_frame)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/exception_trace.py", line 289, in _render_snippet
    self._render_line(io, code_line)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/exception_trace.py", line 402, in _render_line
    io.write_line("{}{}".format(indent * " ", line))
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/cleo/io/io_mixin.py", line 65, in write_line
    super(IOMixin, self).write_line(string, flags)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/api/io/io.py", line 66, in write_line
    self._output.write_line(string, flags=flags)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/api/io/output.py", line 69, in write_line
    self.write(string, flags=flags, new_line=True)
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/api/io/output.py", line 61, in write
    self._stream.write(to_str(formatted))
  File "/home/vagrant/.poetry/lib/poetry/_vendor/py3.7/clikit/io/output_stream/stream_output_stream.py", line 24, in write
    self._stream.write(string)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2502' in position 28: ordinal not in range(256
  • This is also the same error I mentioned first but with "Errno2 No such file or "python : python"

I apologise if I've missed a step here that is obvious, but any pointers would be greatly appreciated.

Activity

  1. finswimmer commented on Sep 10, 2021

    @finswimmer
    Member

    Hello @datacubed ,

    that is probably a duplicate of #4416 or one of the other issues listed in #4433.

    fin swimmer

  2. datacubed commented on Sep 10, 2021

    @datacubed
    Author

    @finswimmer the first comment talks about fixing the "missing python", but the 2nd post I'm not sure if that answers the struggle with being able to call "add package" or if "install" is working within the env? I will check it out and try it

  3. github-actions commented on Mar 2, 2024

    @github-actions

    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.

  4. locked as resolved and limited conversation to collaborators on Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions