I have started playing with Julia today. I was following Steven's MIT turorials to get started. However, when I reached the Plotting section I tried importing PyPlot with:
using PyPlot
however it gave me the following error:
ImportError: No module named site
WARNING: backtraces on your platform are often misleading or partially incorrect
could not load module python: The specified module could not be found.
at C:\Users\Dipto\.julia\PyPlot\src\PyPlot.jl:32
at In[1]:1
in pyinitialize at C:\Users\Dipto\.julia\PyCall\src\PyCall.jl:406
I use Canopy as my Python installation, so all modules required by pyplot should already be available on the machine.
N.B. As indicated in the tutorial I did use Pkg.add("PyPlot") in Julia to install pyplot in Julia as well.
It looks like problem is that PyCall (the bridge between Julia and Python) does not work with Canopy. See: https://github.com/stevengj/PyCall.jl/issues/42.
I ran into the same problem recently after doing a package update, Pkg.update(). It gave me some errors with Nettle and whatnot during the update.
The solution was to delete the .julia directory and reinstall all the needed packages.
The only caveat I feel I have to give is that previous to this recent "reinstall" I used http instead of git for downloading Julia packages. I don't expect this to be an issue though.
Setup
Windows 7 Pro 64-bit
Julia 0.2.0 (2013-11-16 23:44 UTC)
Python 3.3.2 (v3.3.2:d047928ae3f6)
PyPlot 1.1.0
Anaconda (unknown version, installed October 28, 2013)
Related
I think this question has been asked before on the internet, but the proposed solutions have so far not worked.
I am trying to run a script that imports numpy and pandas. When I run using the Python Console in my IDE (PyCharm), everything works fine. However, when I run the script from the command line, the following error is displayed:
DLL load failed: The specified module could not be found.
and
Unable to import required dependencies
I am using Anaconda Navigator. There my Pandas and Numpy are listed. I tried to uninstall them via the conda shell (conda uninstall numpy, conda uninstall pandas) and then install them again, but without result.
Hope anyone can help.
If you haven't already call this (no quotes)
conda activate "name of environment that has your modules installed"
After trial and error, I de-installed Anaconda and installed pip instead. Then I installed the modules using pip, and it worked like a charm.
(Not the most elegant answer since it does not explain why things went wrong in the first place, but it offered a workable solution at least.)
I am using miniconda. Spyder is installed in the base environment and configured with spyder_kernels to point to the interpreter in my work environment called py37. That is where numpy, pandas and matplotlib are installed.
When I activate py37 in a command prompt and use python there I can use matplotlib in my scripts without incident.
When I attempt to run the same scripts from spyder, I get this DLL import error:
File "C:\Users\eli\miniconda3\envs\py37\lib\site-packages\matplotlib\__init__.py", line 190, in _check_versions
from . import ft2font
ImportError: DLL load failed: The specified module could not be found.
Can someone tell me how to diagnose this issue further? It seems like it is trying to import from the correct environment. import numpy and import pandas do work (both are only installed in py37, not base). Is this some sort of interference from the base environment? I'm aware I could install spyder in the py37 environment, but I like the spyder-kernels idea because it would keep the working environment simpler ... if I can get it to work.
It appears that this issue requires an upgrade on the Spyder and Spyder-kernel side and/or an environmental variable be set on the Windows side.
On the Spyder side, there is an improvement in the release candidate version (4.0.0rc2) with the most up-to-date python and spyder-kernels > 1.8. These had to be installed from the spyder-ide channel.
Then for me it still didn't work because an old DLL search path issue. I had to set this environmental variable which takes one system directory out of the search path for Anaconda:
CONDA_DLL_SEARCH_MODIFICATION_ENABLE to 1
On my system, I think it might have been interesting to try only this latter change.
My gratitude to the spyder developers. This took several iterations.
I have just installed the stable version of TensorFlow 2.0 (released on October 1st 2019) in PyCharm.
The problem is that the keras package is unavailable.
The actual error is :
"cannot import name 'keras' from tensorflow"
I have installed via pip install tensorflow==2.0.0 the CPU version, and then uninstalled the CPU version and installed the GPU version , via pip install tensorflow-gpu==2.0.0.
Neither of the above worked versions of TensorFlow were working properly(could not import keras or other packages via from tensorflow.package_X import Y).
If I revert TensorFlow to version 2.0.0.b1, keras is available as a package (PyCharm recognises it) and everything runs smoothly.
Is there a way to solve this problem? Am I making a mistake in the installation process?
UPDATE --- Importing from the Python Console works and allows the imports without any error.
For PyCharm Users
For those who use PyCharm. Install future (EAP) release 2019.3 EAP build 193.3793.14 from here. With that, you will be able to use autocomplete for the current stable release of TensorFlow (i.e. 2.0). I have tried it and it works :).
For other IDEs
For users with other IDEs, this will be resolved only after the stable version is released, which is anyways the case now. But this might take some more time for a fix. See the comment here. I assume it will be wise to wait and keep using version 2.0.0.b1. On the other hand avoid imports from tensorflow_core if you do not want to refactor your code in the future.
Note: for autocomplete to work use import statement as below
import tensorflow.keras as tk
# this does not work for autocomplete
# from tensorflow import keras as tk
The autocomplete works for TensorFlow 2.0.0 on CPU version, but the autocomplete does not work for the GPU version.
SOLVED --- See the answers to this problem below.
SOLUTION 1 (best solution)
Is the accepted answer provided above. It works on EAP version, I tested it on several machines with Windows.
SOLUTION 2
Although PyCharm does not recognise the modules, running the .py file works. I still do not know if this is a problem of TensorFlow or PyCharm, but this is the solution that I have found, many people have run into this problem.
SOLUTION 3
Import the modules from tensorflow_core instead of tensorflow
Example: from tensorflow_core.python.keras.preprocessing.image import ImageDataGenerator
However, as mentioned by #Nagabhushan S N in the comment below and above in the accepted answer:
On the other hand avoid imports from tensorflow_core if you do not
want to refactor your code in the future.
I have recently started some development with qpython3 for android and would like to utilize numpy in the code implementation. I have tried to install numpy through the following code process
intall pip
pip.main(['install','numpy])
however, when the code runs the command, I get an error informing me that I must have python 2.7 or python 3.4 installed. It looks as if it tries to install a version of numpy that was meant for an actual python3 installation and not qpython. I also tried navigating to http://qpypi.qpython.org to download the zip file directly, but when I clicked on the link for numpy-qpython, nothing happens.
I use pyinstaller in generate pythion program with matplotlib a exe file
The exe is generated well but when use the exe, there is a error said no module named 'tz'
what does it mean?
I have test the pythinstaller with program with numby and pyqt4 without matplotlib, it worksenter image description here well! )
I have find the solution on pyinstaller git hub provided by Cecil Curry.
It is:
This is a known issue. python-dateutil 2.5.0 is currently broken with respect to PyInstaller, unfortunately.
Until python-dateutil issues a new stable release correcting this, consider temporarily downgrading to python-dateutil 2.4.2. Apologies for the mild inconvenience – and thanks for taking the time to report this, nonetheless.
I have tested and it works