#π Error CodeSnack IDE
130 messages Β· Page 1 of 1 (latest)
@rapid acorn
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.
Use a venv. "externally managed environment" means system python that doesn't like stuff to be directly pip installed there, as it may conflict with stuff installed via system packages.
Virtual environment will fix that
wdym
can u show me what i need to write pls
Looks like it is a docker container
yh i think
!venv please read this embed. Whole. It will tell you what venv is, how to make one, and how to activate it (<-unless your IDE activates venv for you later, you'll need to do this step)
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
dammit
and when i will do it one time, i will have to do it again when i restart my app?
Venv will be already created, only activating it will be required.
Unless you add sourcing the venv into .bashrc or whatever shell you're using
/FKmzpuqUnZ
(bot keeps removing my link π)
i can delete this or not ?
Good thing it's removing it. Ask in @cerulean seal to whitelist it as related to programming and official :x
@last rune when i want to activate it doesnβt work
what error do you get
i think i dont write the right thing
can u copy what i have to write
your code is fine
aside from the fact that you havent put in a token
but what is your error
and what are the warnings when you use decorators
well you go in your terminal and run .venv\Scripts\activate
forward slashes
run ls
yeah you dont have a venv
wtf
if you want one, it's py3 -m venv .venv
that should be right
it's not in ls 
i already did python3 -m venv .venv
yh idk why
so it's present in the file structure but not in ls?
yh..
yeah honestly i'd just use global pip and not bother with venv's if they're failing
i try with python3 -m venv venv and it work
its same as .venv ?
yeah same thing
ok perfect
wait does ls not list folders prefixed with .
wait
ls -a will list all files including hidden files (files with names beginning with a dot)
run that and i'm guessing .venv will be there
wait
lmk what you see
i let the venv?
?
i remove only .venv or venv
edits
show error
i can try with the other
no such file or directory
same errorβ¦
wait there IS no sh
β ls
ο
activate ξ© activate.bat ο
activate.fish σ°· Activate.ps1 ξ© deactivate.bat
σ°£ pip.exe σ°£ pip3.13.exe σ°£ pip3.exe σ°£ python.exe σ°£ pythonw.exe
my ls got me this
there's activate, activate.bat, activate.fish and Activate.ps1
OH
its completely different on linux
@rapid acorn it's .venv/bin/activate
i maybe found
yes
i do with .venv or venv
not ure fault :)
remove venv, keep .venv
Because dot-starting files are "hidden files". ls -A to see those
yep works perfectly
(read lower)
This is not Windows. Source the file
now i do pip install discord.py?
(read lower)
yup
And THAT is why I said to read whole embed carefully. The activation here is clearly separated by Windows vs Linux
why i have this
you installed it, right?
yes
nicky would i be right in saying his editor is pointing to the wrong python instance
Probably
Browse settings. Somewhere in project settings there should be something about interpreter - make it point to python inside the venv
That way IDE will know which python's libs to check for hints like that
python3 app.py
what i need to change for run the code
That's not related to what I said
yh i know
This help channel has been closed. 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.

