#๐ ModuleNotFoundError: No module named 'docx'
61 messages ยท Page 1 of 1 (latest)
@thin dagger
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.
once you have created a venv you need to activate it, have you done that?
when you create a venv it makes a folder, inside the folder is another folder "scripts" and the activation script is in there generally. I think there are different scripts for different shells (powershell vs cmd). Once you get it activated, libraries will install to the venv folder and you will activate it to use them moving forward
if you go into your system environment variables, you can create PIP_REQUIRE_VIRTUALENV
this will stop you from pip installing outside of a venv
that's interesting
(tho I actually do not have pip installed on global at all, so it's not useful for me)
the benefit of using the envvar is that you can simply remove it later if you wanna use pip on global
can't find the folder ๐ญ
what folder?
the scripts folder
o
it may be hidden
maybe in bin?
try running it from your terminal
hmm, looks like it's not a venv from the venv module
or maybe the Windows ones look different
windows venv venv has Include, Lib, and Scripts
I found scripts.py, is that it?
what did you use to create the venv?
is the venv fresh?
what kind of project?
like, it wouldn't be an issue to just make a new one?
possible it's on conda
different process if that rings any bells
only ever seen that used for data science and ML, is why I ask what kind of project
I'm probably distracting you though, Jay is right, it's really not that hard to make a new venv if you know what libraries you need
hmm i'm automating some emails, they send me the data, I put it in the app and it returns a docs filled with the data
cause i need to write a lot of certificates every day
I'll make a new venv then
what OS are you on?
on a POSIX system, the activate is in bin
Mac
Honestly, I can't make it work, I'll just ask someone in the office tomorrow, I'm just an intern so
here is a very good tutorial/article/blog post about how to use venvs both in the shell on different systems and vscode or pycharm if you use one of those https://realpython.com/python-virtual-environments-a-primer/
thank youu
on mac the directory in the venv is named bin, it's only windows that has the Scripts directory for that
as the article states, you need to run
source venv/bin/activate
```to activate your venv, then you can `pip install` the library
Ohh i'll tryy now
ok, so
It says this:
Requirement already satisfied: python-docx in /opt/homebrew/lib/python3.11/site-packages (1.2.0)
I think it's not downloading in the venv
but it says (venv)
when i type
the article covers all of this and a lot more, it's very long and indepth so you might not want to read it all, but you can check the table of content at the start and read the parts that you need or find interesting
do you mean that your prompt start with (venv)?
that would indicate that the venv is activated for that shell instance
but it's still downloading outside the venv ๐
then it might be that it's not activated in your ide where you are trying to run it or write your code
Idk how but i asked an llm, gave some random code and now it worked
๐ anyway thank you guys
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.