CUDA DLL not working within Conda enviornment - python

I was working on using the Simple Transformers python library from here when I got a Windows error with following error when running the example code on the import statement from simpletransformers.classification import ClassificationModel:
"The procedure entry point cusparseGetErrorString could not be located in the dynamic link library cusparse64_10.dll"
I've tried reinstalling the relevant within the Conda environment as described on the GitHub, reinstalling CUDA itself and running a registry cleaner but I haven't been able to help this issue and I've run out of ideas to approach this, so I would appreciate any help.
CUDA has been working fine for me outside of Conda environments previously.

Related

ImportError while using AWS Lambda in Python (via zappa serverless); Numpy

I have an ImportError issue with my AWS Lambda function
I can run this code locally without ImportError
I use zappa serverless for uploading my code to AWS Lambda--which requires a virtual environment and is an end-to-end solution for creating and updating Lambda functions
I previously had this code working on AWS Lambda
I'm not sure of the change I made (#3) that made this code go from working to ImportError. The log output is as follows.
[ERROR] Runtime.ImportModuleError: Unable to import module 'dailycore': Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/var/lang/bin/python3.8"
* The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
I'm unclear if this is a Numpy issue, a Python issue, or a Zappa issue. Two changes I made that may have had an impact:
I separated out some of my personal code, uploaded it to github, and installed it as packages within the virtual environment using pip
I uninstalled Python from my machine and reinstalled it--as I had two versions causing conflict. Upon my reinstallation (Python 3.8), I changed the installation directory from its default.
The code runs from VS Code locally and wholly contained from within the virtual environment (i.e. I don't have any packages installed via pip on my machine outside of virtual environments at this point). The suggestions above may or may apply to this error. I've tried adding a system PATH variable to my Python 3.8 directory. I've tried downgrading numpy to 1.23.0. I've tried uninstalling all dependencies within the virtual environment and reinstalling them.
UPDATE: I found this link and am looking into these comments: https://github.com/Miserlou/Zappa/issues/1222
UPDATE2: I deleted the virtual environment and re-created per a suggestion at the link above. This did not work.
UPDATE3: I think my issue relates to the private package dependencies I installed via pip from my personal github repos (#2-2). This link may be related. Something about dependencies not being at the top level. I am unsure how to fix this issue and/or repackage my private repo or install correctly. Any clarification is appreciated.
UPDATE4: I've isolated my issue to the private package dependencies and how they get called. A the solution may be related to Lambda Layers, tutorial here. Looking into this.
The ImportModuleError is related to this python package: alpha_vantage and not either of my initial theories. I am unsure as to why, though. It seems like it has something to do with Alpha Vantage's setup.py file; although I could be mistaken.
I have removed the reference to Alpha Vantage for now, but if anyone knows why installing this package would throw a numpy error, please elaborate. I think the only reference to numpy would be through the pandas package--which is only an optional install (i.e. extras_requires in setup.py)

Using Matlab.engine and installing tensorflow at the same time

Currently I am working on a project with Jupyter Notebook in which I need to run a matlab script (.m) which includes a function that provides me with data which i try to solve with a tensorflow model afterwards. I can set up an environment that runs the matlab code an gives me the data and I can set up an environment that does the tensorflow thing but my problem is I can`t do it in the same environment.
Here is the setup and the problems. I am using matlab.engine which I installed like described here: https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
To run my Jupyter Notebook I first navigate to the location where my python.exe and the matlab files are lying ("C:\Users\Philipp\AppData\Local\Programs\Python\Python37-32\Scripts"). If I try to run pip install tensorflow (in Anaconda Prompt) I got a lot of different errors like the following. Conda install works but even when it is installed i can`t import it.
ImportError: No module named 'tensorflow.core' or
ERROR: Could not find a version that satisfies the requirement tensorflow or just No module named 'tensorflow'
I searched for all those problems but nothing helped me. I think this has something to do with the directory I am working in and I know it is bad but I have no idea how to change that. The error also occurs in different environments.
Have you tried running !pip install tensorflow directly in Jupyter Notebook? It's a temporary workaround, but I am having the same problems and this one helped. Remember to comment it out after installation, so you wont re-run it by accident.
I found a solution to my problem. For this I needed a Jupyter Notebook and an external .py script that I design as a Flask. I can luckily run those in different environments. I past and request the data from the server by using "get" and "post".
If someone still has another idea to do all this in one JN, I would still be happy about answers.

Python Azure Function in Visual Studio Code - DLL Error

I am trying to run a script which imports all the packages required for a code in visual studio code (there is nothing else in their at the moment apart from the import statements) all packages are installed on the environment being used.
However running just the statement
It returns the error message
I have tried uninstalling and reinstalling all packages, changing to a different environment and creating a whole new azure function.
Any help would be greatly appreciated.
It seems that there is missing a sqlite3 DLL file in your anaconda path C:\Users\954198\AppData\Local\Continuum\Anaconda3\DLLs.
Meanwhile, there is an existing SO thread Unable to import sqlite3 using Anaconda Python which got the same issue with yours, please follow the answer of most voted up to add the lack sqlite dll file to fix it.
I'm afraid that your conda environment or your python environment may be broken, sqlite3 is a default package pre-installed in Python.

Numpy cannot be accessed on Jupyter. Is it a problem with the path and how do I fix that?

This is probably a very basic question but I have not been able to solve it for some time.
My goal is to start using Python with Jupyter Notebook for data analytics.
I first downloaded Python 3.7 on OSx10.95. Then tried to download Anaconda, which failed a few times. Then I downloaded Miniconda and used Wing101. After that I could download Anaconda. However, I did not get Anaconda navigator to work.
Then I started using Jupyter Notebook from terminal. It works but there are a number of problems:
In Jupyter when I try to import pandas and numpy I get an error:
--------
<ipython-input-1-baf368f80de7> in <module>
----> 1 import pandas as pd
2 import numpy as np
~/anaconda3/lib/python3.7/site-packages/pandas/__init__.py in <module>
17 if missing_dependencies:
18 raise ImportError(
---> 19 "Missing required dependencies{0}".format(missing_dependencies))
20 del hard_dependencies, dependency, missing_dependencies
21
ImportError: Missing required dependencies ['numpy']
----------
Numpy is installed though, but it is probably in the wrong place.
Another problem is that the Anaconda and Python files are all over my computer:
The Anaconda navigator is at:
/anaconda3
Pip 3.7 is at:
/Library/Frameworks/Python.framework/Versions/3.7/bin/
Numpy is at:
/Users/lsluyser/Downloads/ENTER/lib/python3.7/site-packages/pandas/compat/
Jupyter files are at:
/Users/lsluyser/Downloads/ENTER/lib/python3.7/site-packages/
and also at:
/anaconda3/lib/python3.7/site-packages
My question is:
What is the desired organization of the program files and how do I achieve this?
Should I move all files from Downloads to another folder?
Should numpy be put under /anaconda3/lib/python3.7/site-packages?
Can the fact that Anaconda navigator does not work have to do with its location?
Thank you very much in advance!
I suggest using Miniconda, which is a smaller alternative to Anaconda. Even if you don't, you should download the packages you need, such as numpy, from
Anaconda Cloud, which should put the files in proper location.
Generally [on Windows] the packages should be in folder C:\Users\<>\Miniconda3\Lib\site-packages and verify the environment variable has necessary paths.
If you're going to work in Python, you will soon realize the need for creating multiple python virtual environments on your computer.
This is because, when working in Python:
You will constantly run into situations that require you to install, upgrade, or downgrade some new module.
Each such install, upgrade, or downgrade could have some unwanted side-effect (something that was working earlier, stops working after the change).
By creating multiple virtual environments, you will be able to perform such installs, upgrades or downgrades within a specific environment, with no risk of affecting your other environments.
Tools such as Anaconda and Miniconda make it easy for you to create and manage such virtual environments.
Under the hood, the creation and management of the virtual environments is probably not much more than setting some environment variables.
I found this to be a good intro to the concept.
For your problem, yes, most likely your problem with numpy can be solved by suitably setting environment variables, but I would suggest not to attempt that.
Instead, use Anaconda or Miniconda to create an environment, and within that environment, use Anaconda or Miniconda to install numpy. You will of course will be prompted about any pre-requisites that may be needed for numpy.

Test Anaconda build after updating packages

I use conda update --all to update my packages. Recently, I encountered an error with Anaconda build, posted at Error while trying to update and use scipy module in Anaconda. It seems now the issue has been fixed. Is there any way, I can test all modules one by one by importing them and deleting them ? I am requesting this because I have noticed that if import doesn't work, I spend a lot of time figuring out the dependency and then the package that is causing this. For instance, a few minutes ago I found that PyCharm 2018.2.4 breaks with the latest version of matplotlib (3.0.0). Hence, it might be helpful to run some type of test script after running conda update --all to ensure that all packages are indeed working--i.e. importable.
I did some research on this topic and found three sources.
First, Anaconda offers run_test.py (Source: https://conda.io/docs/user-guide/tasks/build-packages/recipe.html). However, being new to the world of Python, I am unsure how to go about running a script in Anaconda terminal.
Second, I found: https://conda.io/docs/user-guide/install/test-installation.html. However, this just tells me the version of the package. I am not interested in the version. I need to know whether all packages import properly.
Finally, I found out that there is a method to run test script for all packages at https://anaconda-installer.readthedocs.io/en/latest/testing.html. However, I am unsure how I can run make in Anaconda terminal. I used to use make long time ago when I worked on gcc on Unix environment. Being new to Python, I am unsure how to go about handling this.
I'd appreciate any thoughts or any test script that could help us verify two things:
a) whether all packages have been installed
b) packages are indeed importable; If the package import fails, the script should terminate with handsome error message highlighting the source (package) where import failed.

Categories

Resources