error when importing torchrec module M1 Max - pytorch

I have a MacBook Pro with M1 Max processor, macOS 12.4. I was following the Pytorch tutorial for their library torchrec (CPU only). When I try to import the library torchrec I am prompt with the following error
OSError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/dlrm_env2/lib/python3.10/site-packages/fbgemm_gpu/
fbgemm_gpu_py.so, 0x0006): tried: '/opt/homebrew/Caskroom/miniforge/base/envs/
dlrm_env2/lib/python3.10/site-packages/fbgemm_gpu/fbgemm_gpu_py.so' (not a mach-o file)
Any suggestion in how to solve it? I tried to create a new environment and install again the library but still I am prompt with the same error.

Related

symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon' Mac M1 Pycharm error

I am trying to use face_recognition for python in my django project but it does not seem to work as it is giving error when i write import face-recognition I am using it in pycharm, M1 macbook air, django rest framework. Following is the versions
Python 3.8
face_recognition 1.3.0
dlib 19.23.0
here is error:
ImportError: dlopen(/venv/lib/python3.8/site-packages/_dlib_pybind11.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon'
If anyone can help me solve this error or know any work around to get it working ?

Is it possible to choose which file tensorflow is installed in?

I've been getting a warning when trying to install tensorflow on my windows pc, through the command prompt:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\RCG\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\tensorflow\\include\\external\\com_github_grpc_grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\client_load_reporting_filter.h'
When looking this up, I found out that windows can't accept file paths longer than 250 words or so.
I've tried installing through anaconda but then I get a different error in pycharm: module not found (I've used an anaconda environment and tried installing through pycharm packages)
So I'm wondering if I can manually decide the file path for TensorFlow so windows will accept it.
Python was installed through microsoft store (otherwise pip wouldn't work)

Dlib ImportError in Windows 10 on line _dlib_pybind11 import *, DLL Load Failed

I am able to successfully install Dlib with CUDA support in Windows 10 but getting an error during "import dlib" in my python code of computer vision project.
Environment: Windows 10, Python 3.7.6 (Anaconda), CUDA 11, CuDNN 10.2
Error Message:
>>> import dlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\dlib-19.20.99-py3.7-win-amd64.egg\dlib\__init__.py", line 12, in <module>
from _dlib_pybind11 import *
ImportError: DLL load failed: The specified module could not be found.
This can be solved by copying the cudnn64_7.dll (available here: https://developer.nvidia.com/cudnn)
into the %CUDA_PATH%/bin directory (probably something like this: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin)
I am able to find and fix this issue. CUDA 11 installation wasn't able to add few of the directories into the PATH environment variable (Windows 10). It was truncated due to the max length of 2048 characters. I have removed a few of the unused software paths from PATH value and after reinstallation, dlib 19.20 is working with CUDA 11 now.
I created an issue on DLIB Github under the following link which has more information regarding error logs and snapshots for this issue.
https://github.com/davisking/dlib/issues/2097
In my environment, the problem was due to an error somewhere in the build process that resulted code to load CuDNN dynamic libraries not being included in the generated file dlib/__init__.py despite having no build error. In my case the file always included this strange block of code:
if 'OFF' == 'ON':
add_lib_to_dll_path('cudnn-NOTFOUND')
add_lib_to_dll_path('C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/lib/x64/cudart.lib')
The second line's cudnn-NOTFOUND gave a clue of what happened with my build.
As I followed instructions on this page, copying all the binaries and include files to the right places within the CUDA directory, I only needed to modify the code to (similar to what Epic Chen's answer suggests but I got rid of the if clause and the bad code line):
add_lib_to_dll_path('C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/lib/x64/cudart.lib')
That workaround fixed the problem for me.
My configuration is CUDA 11.5, CuDNN 8.3.1.22, dlib compiled using Visual Studio 2019. The environment variable CMAKE_PREFIX_PATH to the CuDNN directory to get the compiler to find the include files and libraries.
If you are using Anaconda, uninstall dlib and reinstall dlib.
In anaconda command prompt, type
pip uninstall dlib
After successfully uninstalling, type
pip install dlib
It helped me fix the problem.
Try to check the __init__.py file which the error message indicate as below.
Your path is not the same as me.
In the __init__.py file, the if statement should be 'ON' == 'ON'
Besides, the following library paths must be correct. Your version may not be the same as me.

Process to install JupyterLab using Miniconda

I am trying to get jupyterlab working using an environment handled by miniconda. However, starting from a fresh environment using python 3.8.0 and simply doing
conda install -c conda-forge jupyterlab
First lead me to an asyncio related error. I was able to solve it using this answer.
Now I am facing a DLL import error :
File "C:\Users\XXXX\AppData\Local\Continuum\miniconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
And I can't solve this. I tried using python 3.6.0 instead of 3.8.0. This did not work.
Any idea ? I am using Windows 10 build 1809 64 bits system.

OpenCL error using Python 3.6 on Windows 10

I am trying to use PyOpenCL for the first time on Windows 10 (64 bit) to accelerate some code using my GPU. When trying to import pyopencl I get the error:
File "C:\Users\me\Anaconda3\lib\site-packages\pyopencl\__init__.py", line 39, in <module>
import pyopencl._cl as _cl
ImportError: DLL load failed: The specified module could not be found."
I am using Python 3.6.8 and have the pyopencl 2018.2.5+cl21 package installed.
I have also just installed the latest CUDA toolkit cuda.10.1.105 and Visual Studio as recommended during the CUDA toolkit installation.
The OpenCl.dll file in the Windows\system32 folder, is the 2.2.1.0 file version. I checked this by going into Computer Management clicking on my Nvidia GeForce GTX 1050 display adaptor.
From other post recommednations, I have tried substituting the OpenCl.dll file by others found in my system (see photo) without results. I have then reverted to the original file located in that folder.
Image for search results of 'OpenCl.dll'
I have also downloaded from and installed pyopencl‑2018.2.5+cl21‑cp36‑cp36m‑win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl, without success. The error keeps popping up.
I am completely new to OpenCL, CUDA etc. Please forgive me if the error is easy to solve. Thank you for your help and please let me know if you need any other information.

Resources