python-dotenv icon indicating copy to clipboard operation
python-dotenv copied to clipboard

bug: Getting "dotenv" could not be resolved error

Open Pradumnasaraf opened this issue 2 years ago • 2 comments

  • Getting Import "dotenv" could not be resolved Pylance (reportMissingImports) again and again, although it is not affecting in development and running of the program, sometimes it can be annoying.

Screenshot from 2022-03-01 14-50-33

Pradumnasaraf avatar Mar 01 '22 09:03 Pradumnasaraf

Hi, thanks for reporting this issue. We've seen similar reports in the past but so far I don't think any of them has ever shown that Python-dotenv itself was the cause of the issue. Do you have any reason to believe this is something we can fix in Python-dotenv?

bbc2 avatar Mar 01 '22 17:03 bbc2

Hi there, i just faced the exact same issue as you, what helped me was to include # .env at the header of your .env file, i realized at least that VScode was able to recognize the dotenv namespace. And the import error should be gone.

thatguylor avatar Apr 20 '22 13:04 thatguylor

Same issue here :(

diegotco avatar Dec 10 '22 04:12 diegotco

Same

SeverumYu avatar Jan 26 '23 02:01 SeverumYu

Consegui resolver com: sudo pip3 install python-dotenv

Cliciaf avatar Mar 25 '23 20:03 Cliciaf

Consegui resolver com: sudo pip3 install python-dotenv

I'm on Windows 10, CMD runs as Admin didn't work

BraveVN avatar Apr 14 '23 03:04 BraveVN

Same here. It's definitely installed in venv and even the system.

wnowicki avatar Apr 30 '23 19:04 wnowicki

Same issue

jacksonpradolima avatar Sep 07 '23 20:09 jacksonpradolima

Тщже самое

Rishat-Ver avatar Sep 16 '23 21:09 Rishat-Ver

same here

jrledezma avatar Oct 05 '23 00:10 jrledezma

For those who come to this topic, I figured out that I need to setup a virtual environment (It's a basic for Python, I'm a Nodejs-based so I don't know anything about virtual env). You can see the instruction here: https://docs.python.org/3/library/venv.html.

Then put all of your codebase into that new venv folder → activate the virtual env → install packages and it works.

Make sure to activate the virtual env every time you install package and run the code.

BraveVN avatar Oct 05 '23 01:10 BraveVN