I’m experiencing a segmentation fault when trying to import the osqp package in Python on my MacOS system. I’ve tried to isolate the environment by using a virtual environment. Here are my System Specs:
System Information:
MacOS Version: macOS Big Sur 11.7.10
Python Version: Python 3.11.2
Additional Information:
- I have tried reinstalling Python and creating the virtual environment multiple times.
- Other packages install and import without issues.
- I have also tried installing osqp with different versions but the problem persists.
Steps to Reproduce:
- Create a new virtual environment.
- Upgrade pip to the latest version.
- Install the osqp package.
- Attempt to import the osqp package using the verbose setting.
Detailed Steps:
Here is what I input in the terminal and I have included the last logs for step 3 and 5 showing that installation is successful but import fails with a segmentation fault.
# Step 1: Create a new virtual environment
python3.11 -m venv venv
# Step 2: Activate the virtual environment
source venv/bin/activate
# Step 3: Upgrade pip
pip install --upgrade pip
# Step 4: Install osqp
pip install osqp
**Installing collected packages: numpy, scipy, qdldl, osqp
Successfully installed numpy-2.0.0 osqp-0.6.7.post0 qdldl-0.1.7.post4 scipy-1.14.0**
# Step 5: Try to import osqp
python -v -c "import osqp"
**import 'osqp.utils' # <_frozen_importlib_external.SourceFileLoader object at 0x113323650>
zsh: segmentation fault python -v -c "import osqp"**
Getting Segmentation Fault
Instead of importing normally, it results in a segmentation fault and crashes the python session.
kpardeshi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1