dhhagan / opcsim

opcsim is a python package for simulating low-cost optical particle sensors
MIT License
14 stars 2 forks source link

2023 Updates! #99

Open jhaskinsPhD opened 11 months ago

jhaskinsPhD commented 11 months ago

Hi David,

Really nice package! I wanted to use it so badly for a student project, but in order to actually get it to install in python3 as of 10/2023, I had to enlist an IT guy at the University of Utah... So, here's what we had to do.

Step 1: Create a FRESH python environment and download latest version of OpcSim (not useful for you probably...)

# PART 1: Installation of the miniconda3 on our local linux servers
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh -b -p /scratch/general/vast/u0253283/jessica/mymini3

# Set PATH to mymini3
export PATH=/scratch/general/vast/u0253283/jessica/mymini3/bin:$PATH

# Check PATH & version
u0253283@notch309:jessica]$ echo $(which python3)
/scratch/general/vast/u0253283/jessica/mymini3/bin/python3

[u0253283@notch309:jessica]$ python3 -c "import sys; print(sys.version)"
3.11.4 (main, Jul  5 2023, 13:45:01) [GCC 11.2.0]

# PART 2: Installation of opcsim
# Download opcsim:
git clone https://github.com/dhhagan/opcsim.git 
cp -pR opcsim bak

Step 2: List of things we had to do to strip down opsim to its bare essentials and actually import/install it in our fresh python environment:

  1. We had to remove the poetry lock
  2. The requirements are hard coded in with version numbers for ALL packages which keeps it from being able to use new updates to those packages... So, we clean up requirements.txt file
  3. In 'pyproject.toml', we had to cut the file to its essentials
  4. Then in order to install it in our miniconda3 python library, we did a local developer install using the -e flag as follows:
    cd /scratch/general/vast/u0253283/jessica
    python3 -m pip install -e opcsim  
    python3

    after which we were finally able do to: >>>import opcsim

I couldn't attach the full build here (limit 32MB zip file), but I've shared the biggest changes and will email the rest...) Hope that helps get this package updated for folks to use again! I'd hate to see it fade into "unmaintained" territory... I'd almost certainly use it in my classes!

opcsim.zip opcsim.egg-info.zip