- Python 3.7 or higher
rsimpy requires the following Python packages:
Core dependencies:
numpy- Numerical computingpandas- Data manipulation and analysisxarray- Multi-dimensional labeled arraysscipy- Scientific computing and optimization
Visualization:
matplotlib- Static plottingbokeh- Interactive visualizations
Optional:
h5py- For HDF5 file support (if needed)netcdf4- For NetCDF export (if needed)
# Clone the repository
git clone https://github.com/TiagoCAAmorim/simpython.git
cd simpython
# Install in editable mode
pip install -e .This method is recommended if you plan to:
- Modify the source code
- Contribute to development
- Stay updated with latest changes
# Clone the repository
git clone https://github.com/TiagoCAAmorim/simpython.git
cd simpython
# Install
pip install .pip install git+https://github.com/TiagoCAAmorim/simpython.gitAfter installation, verify that rsimpy is correctly installed:
# Test import
import rsimpy
print(f"rsimpy imported successfully")
# Check modules
from rsimpy.cmg.sr3reader import Sr3Reader
from rsimpy.cmg.gridfile import GridFile
from rsimpy.common.template import TemplateProcessor
print("All core modules imported successfully")It's recommended to use a virtual environment to avoid conflicts with other packages.
# Create virtual environment
python -m venv rsimpy_env
# Activate (Linux/Mac)
source rsimpy_env/bin/activate
# Activate (Windows)
rsimpy_env\Scripts\activate
# Install rsimpy
pip install -e /path/to/simpython# Create conda environment
conda create -n rsimpy python=3.9
# Activate
conda activate rsimpy
# Install dependencies
conda install numpy pandas scipy matplotlib bokeh xarray
# Install rsimpy
pip install -e /path/to/simpythonIf you encounter import errors:
ImportError: No module named 'rsimpy'Solutions:
- Ensure rsimpy is installed:
pip list | grep rsimpy - Check your Python path:
import sys; print(sys.path) - Reinstall:
pip install --force-reinstall -e .
If you have issues with dependencies:
# Upgrade pip
pip install --upgrade pip
# Install dependencies manually
pip install numpy pandas scipy matplotlib bokeh xarray
# Then install rsimpy
pip install -e .If interactive plotting doesn't work:
# Ensure bokeh is installed
pip install bokeh
# For Jupyter notebooks
pip install jupyterIf you can't read SR3 files:
Check file permissions:
ls -l simulation.sr3Verify file format:
from pathlib import Path
file_path = Path("simulation.sr3")
if file_path.exists():
print(f"File size: {file_path.stat().st_size} bytes")
else:
print("File not found")- Use forward slashes in file paths or raw strings:
r"C:\path\to\file" - Some CMG files may have encoding issues. Try
encoding='latin-1'if UTF-8 fails
- File paths are case-sensitive
- Ensure proper permissions on CMG files:
chmod +r simulation.sr3
For use in Jupyter notebooks:
# Install jupyter
pip install jupyter
# Install ipywidgets for interactive features
pip install ipywidgets
# Enable bokeh extension
jupyter labextension install @jupyter-widgets/jupyterlab-managerExample notebook usage:
from rsimpy.cmg.sr3reader import Sr3Reader
from bokeh.io import output_notebook, show
# Enable bokeh in notebook
output_notebook()
# Use rsimpy
sr3 = Sr3Reader("simulation.sr3")
data = sr3.data.get("well", "OILRATSC", "PROD-01")cd /path/to/simpython
git pull origin mainChanges are immediately available (no reinstall needed).
cd /path/to/simpython
git pull origin main
pip install --upgrade .For contributing to rsimpy:
# Clone repository
git clone https://github.com/TiagoCAAmorim/simpython.git
cd simpython
# Create development environment
python -m venv dev_env
source dev_env/bin/activate # or dev_env\Scripts\activate on Windows
# Install in development mode with dev dependencies
pip install -e .
# Install testing tools
pip install pytest pytest-cov
# Run tests
python -m pytest tests/To remove rsimpy:
pip uninstall rsimpyIf installed with -e, also remove the repository directory.
If you encounter issues:
- Check the documentation
- Review examples
- Check existing issues on GitHub
- Create a new issue with:
- Python version:
python --version - rsimpy version:
pip show rsimpy - Error message and traceback
- Minimal reproducible example
- Python version:
After successful installation:
- Read the Getting Started Guide
- Try Quick Examples
- Explore Module Documentation