-1

I’m hoping to use azure-data-tables in my Python code. I'm working in VScode on an Azure HTTP trigger. I’ve run pip3 install azure-data-tables in the terminal on my Mac. However, when I import azure-data-tables in my file on VS code, it’s underlined in red and does not recognize it. Does anyone have any suggestions of what to try?

wovano
  • 4,543
  • 5
  • 22
  • 49
Soph
  • 1
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 23 '22 at 05:00
  • Did you try to run the code? Did it work? If it's only VSCode that doesn't recognize your imports, make sure it uses the same Python interpreter for which you installed the module. There are many many posts on SO that explain how to do this (not sure how this relates to Azure though). – wovano Jun 24 '22 at 09:40

2 Answers2

0

It is a possibility that you might be missing a virtual environment. You can install the virtualenv to your environment first and install azure-data-tables once again.

Install Virtual Environment

pip3 install virtualenv

Create Virtual Environment

Python3 -m venv <Your_Virtual_Environment_Name>

Activate Virtual Environment

<Your_Virtual_Environment_Name>\Scripts\Activate.ps1

Get Requirements.txt

pip3 freeze > requirements.txt

REFERENCES: virtual environment

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18
0

Because python package names cannot contain hyphens. Please replace the package name ( azure-data-tables ) imported in your code with azure.data.tables or azure_data_tables.

enter image description here

In addition, as mentioned above, virtual environments can help you install packages of different functions in different environments, which is convenient for code management and operation.

If multiple python environments exist on your machine, please use CTRL + SHIFT + P to open the command palette, type and select Python: Select Interpreter (or click on the interpreter version displayed in the lower right corner). Then choose the correct python interpreter.

enter image description here

JialeDu
  • 6,021
  • 2
  • 5
  • 24