# Numpy in Jupyter GCC-4.6 error



## PeterSprague (Oct 2, 2016)

I have Jupyterhub running in a jail with Python 3.5.

```
$ pip3 install numpy
```
installs with no errors


```
$ python35
>> import numpy
>> [aka no error]
```

In notebook cell:

```
import numpy as np
```

Gives error:

```
ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc48/libgfortran.so.3 not found
```
Ports installed include lapack, openblas, gcc, gcc46, cblas, pkgconfig


```
$ pip3 install scipy
```
Throws all kinds of errors related back to gcc 4.6 fortran

Any ideas how to fix this?  Haven't found anything that works so far.


----------



## PeterSprague (Oct 3, 2016)

Brute force solution:


```
$ portmaster gcc5
$ ln -s /usr/local/lib/gcc5 /usr/local/lib/gcc
$ ln -s /usr/local/bin/gcc5 /usr/local/lib/gcc
```

For this jail:
in /etc/make.conf

```
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc5)
CC=gcc49
CXX=g++49
CPP=cpp49
.endif
```

Edit /etc/libmap.conf:

```
libgcc_s.so.1   gcc5/libgcc_s.so.1
libgomp.so.1    gcc5/libgomp.so.1
libobjc.so.3    gcc5/libobjc.so.4
libssp.so.0     gcc5/libssp.so.0
libstdc++.so.6  gcc5/libstdc++.so.6
```

See: http://unix.stackexchange.com/questions/130639/how-do-i-install-the-latest-gcc-on-freebsd


----------



## soulcatcher (Feb 25, 2017)

Your solution is a bit overkill.
I had the same problem and the fix was to run jupyter notebook under the correct LD_LIBRARY_PATH:

```
export LD_LIBRARY_PATH=/usr/local/lib/gcc49
jupyter notebook
```
For the extended explanation see http://www.mianchen.com/running-my-own-jupyter-notebook-server-in-a-freebsd-jail/


----------

