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

'Venv' is not used for some reason? #305

Open
Danipulok opened this issue Oct 18, 2024 · 0 comments
Open

'Venv' is not used for some reason? #305

Danipulok opened this issue Oct 18, 2024 · 0 comments
Labels

Comments

@Danipulok
Copy link

Danipulok commented Oct 18, 2024

Description

For some reason, watchfiles does not use python from activated venv?

Is it expected or not?

Steps to reproduce

Yes, I'm sure I have activated venv, and it's being used.

Steps to reproduce:

  1. Create venv
  2. Activate it
  3. Install rich (or any other dependency)
  4. Create the following file (mre.py):
import sys
print("Python executable:", sys.executable)

import rich
print(rich.__all__)
  1. Run file from console to be sure everything's okay:
$ python mre.py 
Python executable: D:\Code\project\.venv\Scripts\python.exe
['get_console', 'reconfigure', 'print', 'inspect', 'print_json']
  1. Run same command via watchfiles:
$ watchfiles "python mre.py" .
[05:21:25] watchfiles v0.23.0 👀  path="D:\Code\project" target="python mre.py" (command) filter=DefaultFilter...
Python executable: C:\Program Files\Python312\python.exe
Traceback (most recent call last):
  File "D:\Code\project\mre.py", line 4, in <module>
    import rich
ModuleNotFoundError: No module named 'rich'

Operating System & Architecture

Windows-10-10.0.19045-SP0
10.0.19045

Environment

I tested with both cmd and bash, and have the same output everywhere. I use venv, created via PyCharm

Python & Watchfiles Version

python: 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)], watchfiles: 0.23.0

Rust & Cargo Version

No response

Additional info:

When I use watchfiles ".venv/Scripts/python mre.py" ., everything works as expected, since the python from venv is getting used.

where python command result:

$ where python
D:\Code\project\.venv\Scripts\python.exe
C:\Program Files\Python312\python.exe
@Danipulok Danipulok added the bug label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant