Python packages (numpy / pandas / etc) in Visual Studio 2017 on Windows

I just installed the Visual Studio Community with Python and Data Science workloads.

I am creating a new regression project from Python \ Machine Learning template.

First few lines:

from pandas import read_table
import numpy as np
import matplotlib.pyplot as plt

      

At first I get errors: No module named xxx

either Missing required dependencies [xxx]

, for pandas or numpy, or scikitlearn or scipy.

I would guess that they will be installed as part of the Visual Studio workloads, and indeed they seem to be in a folder Anaconda3\Lib\sitpackages

if they should be there. But I tried installing them anyway from the Python Environment window in VS.

If I'm lucky, I'll go through the above mistake Importing the multiarray numpy extension module failed.

.

Anyone have any pointers to the setting?

+3


source to share


4 answers


This is how I got it working: Right click on "Python Environments" in the solution explorer window. Select Add / Remove python environments and then select the environment that has the packages you want, or add packages as needed.



+3


source


I just went through this pain the other day, on 64 bit Windows 7 with the VS 2017 community.

To get the regression example, I had to update Python to version 3.6.1, as the numpy version (1.13.1) installed at the peak is not working with 3.6.0.

Long story short, I downloaded and ran the 64-bit Windows Installer for Python 3.6.1 directly from python.org, then (as you described above) from the VS Python Environment window installed matplotlib (2.0.2) numpy (1.13) .1) and pandas (0.20.3). After that, all imports worked. (NB it takes a while for VS intellisense to speed up with import.)



On my machine pandas, numpy and matplotlib sit in

C: \ Program Files \ Python36 \ Lib \ site-packages

Hope this helps.

+1


source


This seems to work:

I installed the latest version of Anaconda (after uninstalling the version that came with the Python VS workload).

Then I installed numpy, scipy and scikit wheels from this link . It's important to note that I installed them using the Anaconda console (Start -> Anaconda Prompt [Run as Administrator]) as I had another Python system install that I had previously installed as wheels / packages.

This seemed to do the trick after restarting Visual Studio.

0


source


Anaconda needs to be added for pandas, numpy and pyplot. Add Anaconda by right click on Python environment and add Anaconda.

0


source







All Articles