Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installation problems
#1
I am having terrible problems with using python. I have installed Python 3.11.3. I have created a virtual environment. I activate the environment and pip install some packages. They all go off with a hitch. I create a python file within VS Code and attempt to import some installed packages. A whole raft of them do not come up in intellisense, and when I ran the code I get a "no module named:" error. This python file I am running is located in the directory for the project. I go back and look at my scripts file in the virtual environment and do a "pip list". There sit the modules I cannot use.
Reply
#2
Are you activating the venv in VSCode?
Reply
#3
No I activate it in cmd prompt then go back to VS Code.




(May-12-2023, 02:09 PM)jefsummers Wrote: Are you activating the venv in VSCode?
Reply
#4
(May-12-2023, 01:59 PM)standenman Wrote: I am having terrible problems with using python. I have installed Python 3.11.3. I have created a virtual environment. I activate the environment and pip install some packages. They all go off with a hitch. I create a python file within VS Code and attempt to import some installed packages. A whole raft of them do not come up in intellisense, and when I ran the code I get a "no module named:" error. This python file I am running is located in the directory for the project. I go back and look at my scripts file in the virtual environment and do a "pip list". There sit the modules I cannot use.

I have activated the venv from a terminal in VS code. Activates properly. Again, pip list shows langchain install. Next a create a python file in VS Code, try to import "langchain" (no intellisense "langchain" offering) run it and get the "no module" error.
Reply
#5
The basic.
# Make 
G:\div_code
λ python -m venv my_env

# Cd in
G:\div_code
λ cd my_env\

# Activate 
G:\div_code\my_env
λ G:\div_code\my_env\Scripts\activate.bat

# A test file
(my_env) G:\div_code\my_env
λ cat test.py
import sys

print(sys.executable)

# Start Vs Code
(my_env) G:\div_code\my_env
λ code .
So should have VS Code in Path so can use code .(to start VS Code from folder you are in).
Click on down in right corner over python version and it will bring up select interpreter as in image.
[Image: 6KeOHi.png]
When run test.py,so will now use python.exe in my_env folder.
Output:
g:\div_code\my_env\Scripts\python.exe
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Oct2py and Matplotlib installation problems Leloup 2 2,925 Nov-23-2018, 03:32 PM
Last Post: Leloup

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020