Hi, I'm trying to run the same code on two different laptops but I think when I was downloading VSC something was different in the process. On one laptop, the interpreter path is Python 3.10.6 64-bit and on the other laptop, the interpreter path is Python 3.9.6 Venv and there's no option for 3.10.6. Is there any way to fix this?
#π venv/bit differences?
72 messages Β· Page 1 of 1 (latest)
@maiden sun
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
Laptop 1
Laptop 2
Laptop 1 runs the code smoothly, laptop 2 gives a blank screen and doesn't work
you could try installing python 3.10 on laptop 2
Both running the same OS?
yes
there are plenty of other reasons why the same code would run differently on different hardware though
How is python installed on each?
Looks like laptop 2 didn't use homebrew or pyenv to install python and is just using the system install.
can i install it with homebrew? because i tried doing that at first and it kept saying there was no command called brew or pip
okay sorry i should've clarified -- i installed brew, installed python3 and reinstalled it using brew, but the environments are still different
Are you sharing the same venv?
no, laptop 1 doesn't use venv
i tried to run the code on laptop 1 without venv, but it said i needed venv to run it so that's what i did
If you installed python via brew on laptop 2, you may need to reload vscode
i reloaded it, it's giving me these option snow
however, the libraries that i'm trying to use, customtkinter and CTkListbox, they need to be installed by pip becasue brew doesn't have them
when i try to do pip install customtkinter it says command pip not found
You need to install python-venv too
with brew?
Looks like it's already installed. Just create a virtualenv
/opt/homebrew/bin/python3 -m venv .venv
okay, i did that. but the issue is it's not recognizing pip to install the libraries i need
!venv
Virtual environments
Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.
To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)
Then, to activate the new virtual environment:
Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate
Packages can then be installed to the virtual environment using pip, as normal.
For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.
Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.
Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
i'm just confused because i've never needed to do this with laptop 1 and it works perfectly fine
it's saying customtkinter is already installed but doesn't recognize me importing it
Don't call /opt/homebrew/bin/python3
You've activated the venv, so python should point to .venv/bin/python
which is where you installed customtkinter
wdym?
how do i fix that?
Just run python code/test
If you're using vscode to run the code, select the new venv as the python version.
python is a command not found
Then run .venv/bin/python3 code/test
i tried reinstalling vscode, still not working
this isn't going to run because it doesn't recognize the library i'm importing
how do i get it to be in .venv/ and not homebrew?
That's where it is
does not work still
command not found apparently
okay, that worked. looks different from my version of tkinter but customtkinter is what's not working
you have to customize it
it's okay tbh, i'll just not use it on laptop 2 because it's complicated
the only reason why i wanted to use laptop 2 was because laptop 1 was having issues with buttons not responding when being clicked multiple times
but it works if you like move your pointer around a bit and then come back to click it
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.