# Python SciPy with Python3.x on FreeBSD 11



## ced (Dec 18, 2016)

Has anyone ever succeeded building this?
Running FreeBSD 11.0-RELEASE-p3 with pkg-tree as latest:

```
FreeBSD: {
    url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
    ...
}
```

It keeps failing to build this... .

Steps I'm doing:

1. Create a python3.5 venv
`python-3.5 -m venv my_venv`

2. Go into the venv
`source my_venv/bin/activate`

3. Try install scipy
`pip install scipy`

Ends with:


```
File "scipy/linalg/setup.py", line 20, in configuration
        raise NotFoundError('no lapack/blas resources found')
    numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
```

Noticed there's a scipy port in the ports tree, but it's relying on Python 2.x and for this project I need 3.x .

I'd really hate to throw my project over to Linux just because of this stupid scipy :\

If anyone has experience or knows anyone with experience setting this up in this kind of environment, I'd be very grateful.

Thanks!


----------



## chrbr (Dec 18, 2016)

In PR 214853 a patch for math/py-matplotlib is suggested ro enable it to build with Python3. This is just one part of the puzzle, it depends which parts of science/py-scipy you need.


----------



## ced (Dec 18, 2016)

Thanks... good to know..but it's indeed only a little part.. the entire scipy has a huge amount of dependencies.
Right now I cut a corner by doing the following:
- fetch Anaconda3 for Linux (https://www.continuum.io/downloads)
- enable Linux 64-bit compatibility
- install Linux base packages based on Centos 7
- install Anaconda3
- add its path to my $PATH variable so I can do the weird thing like 'source activate <venv>' rather than source trying to read a file called 'activate'.

With that I got it to work... . I don't know enough about scipy nor FreeBSD yet to be able and make some patches for this  I really wish I could because this feels very ugly. Thanks for the reply!


----------



## ced (Dec 22, 2016)

So in the end, the dirty hack in Anaconda was too dirty and I didn't feel comfortable with it. It also started to cause me more headache than any good, so I retried.

Things I learned with deploying scipy:
- if you get any error about blas/lapack, install the packages 'blas' and 'lapack'. 
- if you get an error about 'no module core in Numpy' or something similar, try to just open Python, and do an import numpy. You'll get an error. That's the real culprit to troubleshoot.
- In my case I had to add to /etc/libmap.conf:


libgcc_s.so.1   gcc49/libgcc_s.so.1
libgomp.so.1    gcc49/libgomp.so.1
libssp.so.0     gcc49/libssp.so.0
libstdc++.so.6  gcc49/libstdc++.so.6


- After this step, import numpy works as expected, and so does the installation of scipy.

From then onwards, it's a smooth ride on FreeBSD 11.


----------



## hukadan (Dec 22, 2016)

ced said:


> if you get an error about 'no module core in Numpy' or something similar, try to just open Python, and do an import numpy. You'll get an error. That's the real culprit to troubleshoot


Thanks a lot for the heads up. I failed at this stage trying to solve your problem... and I did not know about libmap.conf(5). So thank you twice.


----------

