Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I create a new Regression project from the Python\Machine Learning template.

The first few lines are:

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

First I get the errors: No module named xxx or Missing required dependencies [xxx], for pandas or numpy, or scikitlearn or scipy.

I would have expected these to be installed as part of the Visual Studio workloads, and indeed they seem to be in the Anaconda3\Lib\sitpackages folder, if that's where they should be. But I tried installing them anyway from the Python Environments window in VS.

If I'm lucky, then I get past the above error to this one: Importing the multiarray numpy extension module failed..

Anyone got any pointers for setting this up?

like image 507
Sean Avatar asked Jul 12 '17 14:07

Sean


People also ask

How do I get NumPy for Visual Studio?

To install numpy, select pip from the dropdown for Python Environment, then type numpy and click on the “install numpy from PyPI” as shown below. Similarly search for scipy and install it using pip. If you get any errors in installing scipy, then download first anaconda from the following site.


1 Answers

This is how I got it to work: Right click on "Python Environments" on the solution explorer window. Select Add/Remove python environments and then pick an environment that has the right packages selected or add packages as needed.

like image 144
Zwitterion Avatar answered Oct 21 '22 22:10

Zwitterion