How to solve theano Segmentation fault? - anaconda

I am running a python file which content is:
import theano.tensor as T
This gives me a Segmentation fault.
I am using anaconda.
How can this be solved?

I had the same problem after I updated scipy from version 0.17.1 to version 0.18.0
Try to create a virtual environment with conda (from Anaconda) only for theano, with the correct versions of scipy and numpy:
conda create --name theano_env theano python=2.7
or (for python 3.5):
conda create --name theano_env theano python=3.5
It solved the problem for me.

Related

Conda CMD Crashes Upon Theano Installation

Here are all the lines that I used to install theano:
# Create env.
conda create --name PyMC3 python=3.6
# Activate
activate PyMC3
# update pip
python -m pip install --upgrade pip
# Install theano reqirements
conda install numpy scipy mkl-service libpython m2w64-toolchain
# Install theano
conda install theano pygpu
I have CUDA drivers installed, which I use for tensorflow in another environment.
At the end of the installation, the CMD closes itself. Then every time I type:
activate PyMC3
It also closes / crashes.
At this time (March 14th of 2019), it seems like Theano doesn't support python 3.6, even though there is a conda package for it.
I used python 3.5 and it installs.

Issues installing Tensorflow on mac

I am following instructions from tensorflow website using virtualenv to install and having following issue when validating installation using import tensorflow as tf in python interactive shell.
Please note, I am running Python 3.7
Here are list of packages I have installed.
Can someone help?
I also tried to remove protobuf suggested by stackoverflow issue using pip uninstall protobuf, but doesn't help.
I was able to resolve above issue after some research. It looks like, tensorflow is not compatible with python 3.7 (as of July 30th 18) which is what I had installed on my computer .
Following github issue helped me resolved the issue.
I installed python 3.6.6 using pyenv and setup virtualenv. Here is what I did:
# Install python 3.3.6 and create virtualenv
$ pyenv install 3.6.6
$ pyenv virtualenv 3.6.6 tensorflow_image_recognition_3_6_6
$ pyenv activate tensorflow_image_recognition_3_6_6
# update pip
$ easy_install -U pip
#Install tensorflow
$ pip3 install --upgrade tensorflow
# Test if tensorflow is installed properly
# open python interactive shell
$ python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

Windows Anaconda Keras Install error

Collecting keras
Using cached Keras-2.0.0.tar.gz
Collecting tensorflow (from keras)
Could not find a version that satisfies the requirement tensorflow (from keras) (from versions: )
No matching distribution found for tensorflow (from keras)
Your question definitely needs more info, but probably you need to install the right version of tensorflow first.
Keras 2 goes well with tensorflow 1, which goes well with python 3.5. If your anaconda runs python 2 or 3.6, first create a python 3.5 conda environment, and install tensorflow and keras there:
conda create -n myenv python=3.5 anaconda
activate myenv
(myenv) pip install tensorflow
(myenv) conda install keras

Import Tensorflow in spyder on mac

I followed the instructions on tensorflow.org:
./conda create -n tensorflow python=2.7
source activate tensorflow
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl --ignore-installed
pip install --upgrade $TF_BINARY_URL
When I run python in terminal, I can import tensorflow
But when I try to import tensorflow in Spyder, I got:
ImportError: No module named tensorflow
How to get tensorflow in Spyder?
I just found out that if environment is changed at the Launcher from root to tensorflow, I can install a fresh copy of Spyder in that environment. Once installed, import tensorflow works.

Python Basemap Import error: "requirement already satisfied" [duplicate]

This question already has answers here:
Python basemap module impossible to import
(18 answers)
Closed 2 years ago.
What works is
import mpl_toolkits
What not works is (Import Error basemap not found)
from mpl_toolkits.basemap import Basemap
I followed the instructions here :
http://matplotlib.org/basemap/users/installing.html
Downloaded the lastest basemap*.tar.gz
I run the following commands:
Inside the geos folder
export GEOS_DIR=~/
./configure --prefix=$GEOS_DIR
make
make install
Inside the basemap folder
python setup.py install
Everything runs in sudo mode and no errors. Goes outputs no python binding but not as an error so i am not sure.
It seems not to be properly installed.
Mac Os X 10.10 Yosemite
Python 2.7.6
if i type
pip install basemap --allow-external basemap --allow-unverified basemap
Requirement already satisfied (use --upgrade to upgrade): basemap in /Library/Python/2.7/site-packages
so it is there but not importable?
What worked for me was this:
brew install gdal
For completeness, I did these things too:
conda install basemap
But this should be similar to your pip install method above.
Also, for completeness, I added this line to my .bash_profile:
export GEOS_DIR=/usr/local/Cellar/geos/3.4.2/
You may need to edit the version number.
Then, you can run:
from mpl_toolkits.basemap import Basemap
The easiest way to install basemap on OS X is to use Ports.
Just type in the below command and the see the magic unfold:
port install py-matplotlib-basemap
Correct me if I am wrong. Using MacPorts will install a "port" version of python.
If you started off with Anaconda python distribution, the easiest way is:
conda install -c anaconda basemap=1.0.7
Please see the page from Anaconda here
The better way is upgrade matplotlib module as follows:
pip3 install matplotlib --upgrade

Resources