Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

386
Visualizações
Import keras.datasets not working

I have keras installed on my linux machine, but when I try to import a dataset from the keras.datasets I get an error that it cannot find it.

So for example:

from keras.datasets import mnist

I get the error

ImportError: No module named keras.datasets

I installed keras using pip install and it installed successfully.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Do you have keras.py or keras.pyc in the current working directory? If so, this will mess up the imports. Try renaming the file and/or deleting keras.pyc.

over 4 years ago · Santiago Trujillo Relatório

0

Indeed the problem was that I had multiple versions of Python.

Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.

I found this to be true but it is not necessary to delete anaconda. I had the same issue but with multiple python versions. However, i created an environment that only used the Anaconda version (while in that environment). In terminal (on mac and other suitable terminals), type/copy

conda create -n dataweekends python=2.7 pandas scikit-learn jupyter matplotlib

dataweekends is simply the name of the environment you created. To access this, just use the command

source activate dataweekends

Be mindful that you might (probably) have to reinstall dependencies once in that new environment.

I got this trick from here "https://www.dataweekends.com/blog/2017/03/09/set-up-your-mac-for-deep-learning-with-python-keras-and-tensorflow"

I would also recommend setting up different environments for each project you do in python.

over 4 years ago · Santiago Trujillo Relatório

0

Thanks to the comment from Selcuk which got me on the right track.

Indeed the problem was that I had multiple versions of Python. I followed some online instructions to installing Keras which recommended installing MiniConda/Conda/Anaconda which is its own version of python. So I had two Python2.7 versions installed:

  • Normal Linux Python 2.7
  • Anaconda Python 2.7

Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda