I am getting Import Error in python 3.8.3 - python

I was getting this Error while importing Tensorflow 2.0 in python 3.8.3
ImportError: Could not find the DLL(s) 'msvcp140.dll or msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads

Related

ImportError blpapi in Python

I'm trying to use blpapi in python. Since my company has a strict firewall, I had to do an offline install of the latest one from condaforge ('blpapi-3.17.1-py38_blpapicpp3.16.1.1_1'). I've tried nearly every solution on stackoverflow including:
Pasted the matching C++ SDK dll libraries for C++ 3.17.1.1 into the DAPI folder and anaconda site packages.
Also pasted the dll files in system32 and tried running import blapi with os.add_dll_directory function.
Added the bin and lib C++ SDK dll paths to the system environment PATH as well as in Spyder.
Installed Visual Studio and the relevant C++ MFC, C++/CLI support, MSVC v143 tools etc.
---------------------------- ENVIRONMENT -----------------------------
Platform: Windows-10-10.0.19041-SP0
Architecture: ('64bit', 'WindowsPE')
Python: 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Python implementation: CPython
This Python version does not use PATH to find dlls
blpapi package at: "C:\ProgramData\Anaconda3\lib\site-packages"
Current directory: "C:\blp\blpapi_cpp_3.17.1.1\lib"
----------------------------------------------------------------------
DLL load failed while importing _versionhelper: The specified module could not be found.
Could not open the C++ SDK library.
Download and install the latest C++ SDK from:
http://www.bloomberg.com/professional/api-library
If the C++ SDK is already installed, Python 3.8+ on Windows requires that the
path to the library is added to 'add_dll_directory', i.e.:
with os.add_dll_directory('<path to blpapi dlls>'):
import blpapi```

Cython setup.py can't find installed Visual C++ Build Tools

I am attempting to build my cython code using this setup.py file:
from distutils.core import setup
from Cython.Build import cythonize
import numpy as np
setup(
name="My Cython Project",
ext_modules=cythonize("*.pyx", include_path=[np.get_include()], language="c++")
)
and
python setup.py build_ext --inplace
But am getting the error:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
But I installed the build tools and I know they work because I can manually build my project using these commands in the Developer Command Prompt for VS 2019:
cython -a -3 --cplus Myfile.pyx
cl /LD /O2 /EHsc [ include files ] Myfile.cpp [ python 3.8 lib ]
Why does cython think the build tools are not installed? Do I need to add something to PATH?
(I run the same project on my macOS machine with gcc installed and it works perfectly.)
Screenshot of my Visual Studio Installer Screen
The problem is that setup.py shows you incorrect version of MSVC. It's not the 14.0 that you need. I just did solved the very same issue myself, also for Python 3.8, so here are the steps.
When you compile something for Python, you should use the same compiler version. So let's see what compiler was used for you Python:
python -c "import sys; print(sys.version)"
Mine prints:
3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]
So I need MSVC version 1916.
You can check which version it is here: https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B . For me 1916 is Visual Studio 2017 version 15.9 - likely that's what you really need.
You to M$ downloads https://my.visualstudio.com/Downloads?q=Visual%20Studio%202015&pgroup= , search, for example, for "Visual Studio Community 2017 (version 15.9)" and install it (or just the compiler) and enjoy.
P.S. It is likely that you will need exactly that compiler for all your python 3.8 extensions (unless you use direct dll calls) and you will need to recompile the code you did in Studio 2019.

Error when installing psycopg2 on Windows

I can't install psycopg2 on Win10 x64 / Python 3.8.
When I run MyProject\venv>pip install psycopg2-binary
I've got error Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools
But I've already installed BuildTools (from https://visualstudio.microsoft.com/downloads/) and MS Visual C++ redistributable 2015-2019
Also I've tried to install prebuild binaries - https://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg but for any package (win_amd64 or win32) I've got error like "psycopg2-2.8.6-cp39-cp39-win32.whl is not a supported wheel on this platform."
Could you please help - how can I finally install them?

error: Microsoft Visual C++ 10.0 is required while installing Pandas

While trying to install Pandas and sasl modules in Windows via pip, I am getting below error.
error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
I have tried to install Microsoft Visual C++ 10.0 but getting the same error. My Python version is 3.4.0 and pip version is 18.1
C:\Users\ishan\PycharmProjects\python-Simple\venv\Scripts>python --version
Python 3.4.0
C:\Users\ishan\PycharmProjects\python-Simple\venv\Scripts>pip --version
pip 18.1 from c:\users\ishan\pycharmprojects\python-simple\venv\lib\site-
packages\pip (python 3.4)

Facing ImportError: DLL load failed while implementing Microsoft azure iothub_service_client

I am trying to develop a python console application that implement IoT using Microsoft azure. For this purpose, I am following very basic tutorial made for python developers by Microsoft azure in my Windows 10 machine. Pre-installed Visual C++ redistributable package is one of the most important requirement to allow the use of native DLLs from Python among 4 prerequisites described into the Introduction section of the tutorial.
My system configurations:
Software Version
-------------------------------------------------------
Python: 3.5.2
Visual C++ redistributable package: 2010, 2013, 2017
Node: 6.10.2
Figure of Visual C++ redistributable package:
Problems:
Visual C++ redistributable package is not installed since Visual C++ redistributable package in the tutorial is an older version (2015) then mine (2017).
It shows following error:
Traceback (most recent call last):
File "CreateDeviceIdentity.py", line 2, in <module>
import iothub_service_client
File "F:\Settings\Windows\ProgramFiles\Python\lib\site-packages\iothub_service_client\__init__.py", line 1, in <module>
from .iothub_service_client import *
ImportError: DLL load failed: The specified module could not be found.
Question:
How how can I solve this problem?
N.B: I have completed those basic tutorial provided for Java and NodeJS developers.
I tried to reproduce your issue successfully, and I made the code import iothub_service_client works after installed Visual C++ Redistributable for Visual Studio 2015. So please install the 2015 version on your machine to resolve it, as the tutorial said,
If you are using Windows OS, then Visual C++ redistributable package to allow the use of native DLLs from Python.
The link in the tutorial is for the 2015 verison.

Categories

Resources