im using Pycharm 2022.2.3.
I have Anaconda Navigator 2.3.2. Created in anaconda a new virtual environment based on python 2.7 called testpy2. Added the numpy package needed to execute a code. I did it from Ananconda Navigator GUI. The installation was succesful. I could see now numpy in my installed package list.
Open Pycharm project, select as interpreter the existing conda environment test2py.
The code is:
import random
import numpy as np
print "Hola"
The problem is it give the error: ImportError: DLL load failed when importing Numpy.
So I cant execute the program because of numpy.
When i go to see the packages something similar to:
then i got stuck in loading. Pycharm should recognize and load all the packages in the conda environemnt as shown in the image above, but in my case i got stuck in loading.
Im running on Windows 10 and i dont have any python installed at all
Any help would be apreciated.
Related
I am new to Deep Learning and I have just installed tensorflow on my Mac,
however, there are some problems.
I am sure I installed successfully because I can run tensorflow on Terminal using python 3.5
import tensorflow as tf
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0) # also tf.float32 implicitly
print(node1, node2)
there is an output on my bash
Tensor("Const:0", shape=(), dtype=float32) Tensor("Const_1:0", shape=(), dtype=float32)
However, when I run import tensorflow as tf on Python Console of PyCharm. A problem occurred:
>>> import tensorflow as tf
ImportError: No module named 'tensorflow'
I just went through this a few days ago after switching to PyCharm. You have to select the right Project Interpreter so it can find the Python installation that includes Tensorflow. In the menu go to PyCharm->Preferences and under the section Project: PyCharm on the left select Project Interpreter. In my case, I select 3.5.2 (~/anaconda/bin/python) because there's where my Tensorflow seems to reside. Whatever versions you select, scroll through the window at the bottom to make sure you see Tensorflow listed as a Package.
IMPORTANT: in my case it seems that once you OK this, it takes a while for PyCharm to digest? Because for a while the 'Run' button is greyed out and you can't run your program. Took me a while to figure what I'm doing wrong, but looks like you just need to give it sometime and it picks it up and the Run button goes back to green. Hope this works for you...
I am using the Community Edition, for what it's worth...
I'm using PyCharm 2018.1.4 Community Edition on Fedora 28, and have TensorFlow 1.9.0 installed (through "sudo pip3 install --upgrade tensorflow"). Here is my step to load TensorFlow
File > Settings > Project > Project Interpreter > Change to "/usr/bin/python3.6" in Project Interpreter, then the installed Package will be loaded and displayed.
Good luck.
Getting the No module named 'matplotlib.pyplot'; matplotlib is not a package error when trying to run:
import matplotlib.pyplot
plt.plot([1,2,3,4],[4,7,8,12])
plt.show()
Im running python 3.3, and have installed the correct matplotlib, and six library. i have checked this by running pip list.
I have also tried running the file in terminal, and when i do this the error changes from matplotlib is not a module to no module named pyplot.
I am using Python 2.7 through Anaconda 2.7.8 and need Kapteyn 2.2 to perform Non-linear Least Squares fitting easily (it is probably an alternative to Scipy.optimize.leastsq() for dummies like me!).
After copy-pasting this from a previous post here on Stack Overflow:
conda install -c https://conda.binstar.org/dhirschfeld pyodbc
and then running on my cmd (as I did not have pyodbc installed I think, because of which maybe the command prompt on my Windows 7 64-bit system was not responding well to python setup.py install inside the Anaconda directory where I unzipped the Kapteyn .zip file downloaded from University of Groningen website.
But, after the installing pyodbc properly and running python setup.py install, the cmd gave me an error saying error: command 'C:\Users\windows 7\Anaconda\Scripts\gcc.bat' failed with exit status 1. Later, when I tried to import kmpfit module (needed for Non-linear least square fitting with Kapteyn), here is the problem:
import kapteyn
help(kapteyn)
Help on package kapteyn:
NAME
kapteyn - Kapteyn package.
FILE
c:\users\windows 7\anaconda\kapteyn\__init__.py
PACKAGE CONTENTS
_ni_support
celestial
doccer
filters
interpolation
maputils
mplutil
positions
rulers
shapes
tabarray
wcsgrat
DATA
__all__ = ['celestial', 'wcs', 'wcsgrat', 'tabarray', 'maputils', 'mpl...
__version__ = '2.2'
VERSION
2.2
As you can see, there is no module named kmpfit (or even wcs) here. But according to http://www.astro.rug.nl/software/kapteyn/intro.html, these two should be there.
Kindly help. I have never imported any module before.
Thanks in advance...:-)
I just managed to get this working (on Mac OSX, so you may have to adjust this). My steps were:
$ conda install pyodbc (didn't need to go through binstar)
Download & unarchive the kapteyn package, then navigate to its directory
$ python setup.py install, which used my OS's C compiler and Anaconda's python, and installed kapteyn to my anaconda distro's site-packages, as it should.
Check that kmpfit.so is in the kapteyn folder in site-packages, showing that kmpfit installed correctly.
>> from kapteyn import kmpfit failed, ImportError: cannot import name kmpfit. I did some digging and discovered that it was still importing kapteyn from the folder that I downloaded, not from site-packages.
Delete the downloaded kapteyn folder, then try again. It worked!
I just installed python in my MacOS using the Anaconda distribution. My problem is although the packages (eg. matplotlib, numpy, scipy) came included with the installation, I have to import them to spyder every time which is tedious and it's also tiring that that I have to remind spyder of their functionalities.
For eg, in Windows, I only needed to type in the console:
x=array([...,...,...])
but in my mac it would have to be:
import numpy as py
and then type into the console:
x=py.array([...,...,...])
I do notice that in that the spyder-python console (Windows version), there is a text saying,
Imported NumPy 1.8.1, SciPy 0.13.3, Matplotlib 1.3.1 + guidata 1.6.1, guiqwt 2.3.2
Type "scientific" for more details.
That is probably the reason why I don't have to import anything in Windows because Spyder already did it.
How do I do the same for Mac?
Thank you
I keep getting and error when trying to test machine learning code on Python http://scikit-learn.org/stable/auto_examples/feature_selection_pipeline.html#example-feature-selection-pipeline-py.
I'm using windows 8.1. I've downloaded spyder and anaconda with python version 2.7.
I can run other examples fine, but whenever something uses pipe I get the error:
ImportError: cannot import name make_pipeline.
I'm using the latest development version of scikit-learn.