# Troubleshooting

Welcome to the troubleshooting page for *pyspi*. This section is dedicated to helping you resolve common issues and challenges you might encounter while installing our package. Here, we provide detailed solutions and guidance for a variety of scenarios that new users may face. Our aim is to make your experience with *pyspi* as smooth and efficient as possible.

Please note that this document is continually updated with new information and solutions. If you encounter a problem that is not covered in this documentation, we encourage you to raise an issue on our [GitHub repository](https://github.com/DynamicsAndNeuralSystems/pyspi). Your feedback is invaluable to us, and we will gladly incorporate new resolutions and updates into this documentation to assist others. We are committed to maintaining a comprehensive and user-friendly troubleshooting guide.

***

## Operating System-Specific Troubleshooting

We have sorted the troubleshooting guide by operating system. Select your operating system to receive relevant troubleshooting advice.

<table data-view="cards"><thead><tr><th></th><th align="center"></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td align="center"><strong>Windows</strong></td><td></td><td><a href="https://636746764-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIw3ORxNbDkeyBcdB5svU%2Fuploads%2F7O6rHJeZlfYLK0zZkxyh%2Fwindows_os_icon_light.png?alt=media&#x26;token=b5fe5519-0401-4c1f-8355-372982f699a0">windows_os_icon_light.png</a></td><td><a href="#windows-related-issues">#windows-related-issues</a></td></tr><tr><td></td><td align="center"><strong>Linux</strong></td><td></td><td><a href="https://636746764-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIw3ORxNbDkeyBcdB5svU%2Fuploads%2F6xcNrphaMJqETbrCpyOk%2Flinux_os_icon_light.png?alt=media&#x26;token=663a3a97-af59-4680-b50e-479285e913ed">linux_os_icon_light.png</a></td><td><a href="#linux-related-issues">#linux-related-issues</a></td></tr><tr><td></td><td align="center"><strong>MacOS</strong></td><td></td><td><a href="https://636746764-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIw3ORxNbDkeyBcdB5svU%2Fuploads%2FuPyf4560neH2AcCLM6HA%2Fmac_os_icon_light.png?alt=media&#x26;token=91f08290-8b89-4acd-b6d1-7abacd009ea5">mac_os_icon_light.png</a></td><td><a href="#macos-related-issues">#macos-related-issues</a></td></tr></tbody></table>

***

## Windows Related Issues

***

{% hint style="danger" %}

## Unable to locate Java Paths

{% endhint %}

{% hint style="success" %}
If you are using *Windows* and you get an error that *pyspi* cannot locate your system's Octave and/or Java paths, you can manually set these paths prior to importing *pyspi*:

```python
import os
pathToJAVA_HOME = "C:/Program Files/Java/jdk-20" # Change if you use a different Java JDK
os.environ['JAVA_HOME'] = pathToJAVA_HOME
```

{% endhint %}

*Thank you to GitHub user* [*rmzargar*](https://github.com/rmzargar) *for reporting this issue and providing the solution.*

***

{% hint style="danger" %}

## *python setup.py egg\_info* did not run successfully

{% endhint %}

{% hint style="success" %}
A few users have reported encountering this issue during the installation process (particularly those on Windows OS). This appears to be related to a compatibility conflict between P*ython* version *3.9.0* and *sktime* version *0.8.0*. The current workaround is to re-install pyspi (either in a new conda environment or on your system) using ***python-3.8.0:***

```bash
$ conda create --name pyspi python=3.8.0
$ conda activate pyspi
# navigate to your pyspi directory
$ pip install .
```

{% endhint %}

***

{% hint style="danger" %}

### Pandas Int64Index error

A few users have noted the following error when instantiating the `Calculator` object:

```python
ImportError: cannot import name 'Int64Index' from 'pandas'
```

{% endhint %}

{% hint style="success" %}
You can fix this error by manually removing numpy and pandas, and manually reinstalling the below versions with the following code:

```python
pip uninstall numpy
pip uninstall pandas
pip install numpy==1.22
pip install pandas==1.3.3
```

{% endhint %}

*Thank you to GitHub user* [*rmzargar*](https://github.com/rmzargar) *for reporting this issue and providing the solution.*

***

## MacOS Related Issues

***

{% hint style="danger" %}

### Java JVM DLL not found

```python
OSError: [Errno 0] JVM DLL not found /Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home/lib/libjli.dylib
```

{% endhint %}

{% hint style="success" %}
This issue is similar to those reported [here](https://stackoverflow.com/questions/71504214/jvm-dll-not-found-but-i-can-clearly-see-the-file) and [here](https://stackoverflow.com/questions/71504214/jvm-dll-not-found-but-i-can-clearly-see-the-file); it can arise from the version of OpenJDK identified as the system default. Some Java versions don't include all of the binary (DLL) files that *pyspi* looks for. We recommend following this helpful [tutorial](https://blog.bigoodyssey.com/how-to-manage-multiple-java-versions-in-macos-e5421345f6d0) by Chamika Kasun to install AdoptOpenJDK. In a nutshell, here are the steps you should follow:

* Install homebrew if you haven't already

```bash
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

* Install jenv as your Java version manager

```bash
$ brew install jenv
```

* Add jenv to your shell's configuration file (e.g. *.bashrc* if you use bash, *.zshrc* if you use zsh)

```bash
$ export PATH="$HOME/.jenv/bin:$PATH"
$ eval "$(jenv init -)"
```

* Source your shell's configuration file:

```bash
$ source ~/.bashrc # If you use bash; OR
$ source ~/.zshrc # If you use zsh
```

* Confirm proper installation of *jenv*

```bash
$ jenv doctor
```

Even if this returns some errors, as long as you see *jenv* is correctly loaded, you're all set. We recommend using ***AdoptOpenJDK*** ***version 11***. Note that AdoptOpenJDK has recently transitioned to Eclipse Adoptium, but in some cases, the Adoptium versions might not resolve specific issues. We suggest downloading an older version of AdoptOpenJDK. Here's how you can proceed:

* Go to the [*AdoptOpenJDK GitHub releases page*](https://github.com/AdoptOpenJDK/openjdk11-binaries/releases).
* Look for the version of AdoptOpenJDK for your OS. For Apple Silicon (M1/M2), the OpenJDK11U-jdk\_x64\_mac\_hotspot\_11.0.9.1\_1.pkg, while not specifically designed for the Apple ARM architecture, has been found to resolve certain issues.&#x20;
* Follow the installation instructions for your specific operating system to install the JDK. Make note of the location in which the JDK was installed.&#x20;

Now you will need to add your *AdoptOpenJDK* path to your *jenv* environments. First, you can find where your jdk files are installed with the following command:

```bash
$ /usr/libexec/java_home -V
```

This will list all your installed java JDK versions. Locate the one for *AdoptOpenJDK* version 11 and paste the path:

```bash
$ jenv add <path_to_adopt_open_jdk_11>
```

Confirm *AdoptOpenJDK* version 11 was added to *jenv*:

```bash
$ jenv versions
```

You can set *AdoptOpenJDK* version 11 as your global Java version with the following:

```
$ jenv global <AdoptOpenJDK version>
$ # example:
$ jenv global 11.0
```

{% endhint %}

***

{% hint style="danger" %}

### Pandas Int64Index error

A few users have noted the following error when instantiating the `Calculator` object on MacOS:

```python
ImportError: cannot import name 'Int64Index' from 'pandas'
```

{% endhint %}

{% hint style="success" %}
You can fix this error by manually removing numpy and pandas, and manually reinstalling the below versions with the following code:

```python
pip uninstall numpy
pip uninstall pandas
pip install numpy==1.22
pip install pandas==1.3.3
```

{% endhint %}

***

## Linux Related Issues

***

{% hint style="danger" %}

## Missing pyEDM (Linux)

{% endhint %}

{% hint style="success" %}
Some operating systems/pip versions may be unable to locate pyEDM. In this case, the workaround is to download and install the wheel locally as follows:

1. Download the wheel file (.whl) from the [*pyEDM* repository](https://pypi.org/project/pyEDM/#files) for version 1.9.3 (one of the two Linux versions depending on whether you are running i686 or x86\_64 architecture).
2. Install the `wheel` package if you don't have it already using `pip install wheel.`
3. Navigate in your terminal to where you've downloaded the wheel file.&#x20;
4. Install the wheel file directly with the command `pip install [file.whl]`. For example, that might look like `pip install pyEDM-1.9.3.0-cp39-cp39-manylinux2010_x86_64.whl`.&#x20;
   {% endhint %}

***
