Below is my file setup:
|-Desktop
|--Python Projects
|---Senior Project
|----pyspectra-master
|-----pyspectra-master
|------pyspectra
My goal is to import libraries from pyspectra into Jupyter Notebook. I get a ModuleNotFoundError when I type this code:
from pyspectra.readers.read_spc import read_spc
I am unsure why this happens. I also get an error for this code:
from pyspectra_master import pyspectra
How am I supposed to call pyspectra-master with a dash? It does not seem possible.
Is there an easier way to import modules into python? I saw it possible to import modules directly from Github.
Macgyver notes on creating virtual environment manually:
Create virtual environment for Linux:
python3 -m venv --system-site-packages /opt/venv01
cd /opt/venv01
source /opt/venv01/bin/activate
pip install openpyxl==3.0.7
pip install pyspectra
... if multiple python installs exist, make sure to put the full path of the python.exe file here instead of the default.
/path_of_python/python3.exe -m venv --system-site-packages /opt/venv01
Create virtual environment for Windows:
- Manually install Python for Windows with https://www.python.org/downloads/
- Git Bash can be used like the command line in Linux, but in Windows
- You will need to make sure Python is appended to the PATH environment variable in Windows so the command line has access to the Python tools. This should get added automatically with the Windows Python install
- repeat Linux commands above, but use Windows folders instead; I believe the C: drive looks like /c/ in GitBash for Windows.
- Once your virtual environment is set up, install Virtual Studio Code and open your source code folder (virtual environment folder). This is typically the same folder where you check out github source code. That way everything is isolated. The venv folder is usually called whatever git branch or version you're working on and is checked out from.
- Configure the virtual environment to be active in Visual Studio Code IDE so you can run your application using the IDE tools instead of the command line. Then you can debug your source code using the IDE as well by placing breakpoints.