Python Forum
Installation problems - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Installation problems (/thread-39961.html)



Installation problems - standenman - May-12-2023

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.


RE: Installation problems - jefsummers - May-12-2023

Are you activating the venv in VSCode?


RE: Installation problems - standenman - May-12-2023

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?



RE: Installation problems - standenman - May-12-2023

(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.


RE: Installation problems - snippsat - May-12-2023

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