Setting the path to CUDA in THEANO_FLAGS - theano

I try to set the THEANO_FLAGS and then import Theano. This always results in an error.
In [1]: import os
In [2]: os.environ["THEANO_FLAGS"] = "cuda.root=/usr/local/cuda,device=cuda,floatX=float32"
In [3]: import theano
ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
File "/Users/anonymouse/anaconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 164, in <module>
use(config.device)
File "/Users/anonymouse/anaconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 151, in use
init_dev(device)
File "/Users/anonymouse/anaconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 60, in init_dev
sched=config.gpuarray.sched)
File "pygpu/gpuarray.pyx", line 634, in pygpu.gpuarray.init
File "pygpu/gpuarray.pyx", line 584, in pygpu.gpuarray.pygpu_init
File "pygpu/gpuarray.pyx", line 1057, in pygpu.gpuarray.GpuContext.__cinit__
GpuArrayException: Could not load "/Developer/NVIDIA/CUDA-7.0/lib/libnvrtc.dylib": dlopen(/Developer/NVIDIA/CUDA-7.0/lib/libnvrtc.dylib, 5): image not found
How could I change the path "/Developer/NVIDIA/CUDA-7.0/lib/libnvrtc.dylib" to "/usr/local/cuda/lib/libcuda.dylib"?

Related

I have a problem with compiling my script with PySide6

When i'm trying to compile my app i getting a problem with PySide6.QtSVG
How can i fix this?
Traceback (most recent call last):
File "Application.py", line 2, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "Panel\gui\qt_core.py", line 4, in <module>
from PySide6.QtSvgWidgets import *
ImportError: could not import module 'PySide6.QtSvg'

pytorch geometric: OSError: Symbol not found

could anyone please help me with the following error which appears when loading pytorch geometric (installed following PyTorch torch_sparse installation without CUDA)
Traceback (most recent call last):
File "training.py", line 8, in <module>
from models.gat import GATNet
File "/Users/xxx/yyy/models/gat.py", line 5, in <module>
from torch_geometric.nn import GATConv
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_geometric/__init__.py", line 5, in <module>
import torch_geometric.data
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_geometric/data/__init__.py", line 1, in <module>
from .data import Data
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_geometric/data/data.py", line 8, in <module>
from torch_sparse import coalesce, SparseTensor
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_sparse/__init__.py", line 15, in <module>
f'{library}_{suffix}', [osp.dirname(__file__)]).origin)
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/_ops.py", line 104, in load_library
ctypes.CDLL(path)
File "/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_sparse/_convert_cpu.so, 6): Symbol not found: __ZN2at5emptyEN3c108ArrayRefIxEERKNS0_13TensorOptionsENS0_8optionalINS0_12MemoryFormatEEE
Referenced from: /Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_sparse/_convert_cpu.so
Expected in: /Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch/lib/libtorch_cpu.dylib
in /Users/xxx/opt/anaconda3/envs/my_env/lib/python3.7/site-packages/torch_sparse/_convert_cpu.so
I tried deleting anaconda, deleting my cache and reinstalling. But nothing seemed to help. It is macOS Catalina.
Thanks :)

Scapy can't install

Traceback (most recent call last):
File "/home/predata/soft/Memcrashed-DDoS-Exploit/Memcrashed.py", line 5, in <module>
from scapy.all import *
File "/usr/local/lib/python3.9/dist-packages/scapy/all.py", line 18, in <module>
from scapy.arch import *
File "/usr/local/lib/python3.9/dist-packages/scapy/arch/__init__.py", line 28, in <module>
from scapy.arch.bpf.core import get_if_raw_addr
File "/usr/local/lib/python3.9/dist-packages/scapy/arch/bpf/core.py", line 29, in <module>
LIBC = cdll.LoadLibrary(find_library("libc"))
File "/usr/lib/python3.9/ctypes/util.py", line 341, in find_library
_get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
File "/usr/lib/python3.9/ctypes/util.py", line 147, in _findLib_gcc
if not _is_elf(file):
File "/usr/lib/python3.9/ctypes/util.py", line 99, in _is_elf
with open(filename, 'br') as thefile:
FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a'
i can't run scapy file or something like this, can someone help?
You should retry using the Github version of Scapy. This was fixed
See https://scapy.readthedocs.io/en/latest/installation.html#current-development-version

AttributeError: module 'shutil' has no attribute 'copy'

I have run to a wired error in python 3.5. I appreciate your help.
I want to copy some images from one directory to another directory using shutil. As I know, shutil is a standard library (doesn't need to be installed). But it doesn't work properly. How can I reinstall it or fix the error?
import shutil
import os
import random
## This program copy some images of a folder randomly into an existed directory
src = "/FirstPath/BIODI_V3_175x100/Train_set/"
dist = "/SecondPath/Random_Images_of_BIODI_for_test/"
copied = 0
mlist = os.listdir(src)
#os.mkdir(dist)
for i in range(1000):
rand = random.randint(1,len(mlist))
shutil.copy((os.path.join(src,mlist[rand])),dist)
i += 1
And it is the error:
Traceback (most recent call last):
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 1, in <module>
import shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time
File "/usr/lib/python3.5/tempfile.py", line 44, in <module>
import shutil as _shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'
Original exception was:
Traceback (most recent call last):
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 1, in <module>
import shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'

keras and tensorflow are not running on gpu in centos 7

I have been trying to run a NN in keras using tf as backend in a centos 7 server but I got this error:
Using Theano backend.
WARNING (theano.configdefaults): install mkl with `conda install mkl-service`: No module named 'mkl'
Traceback (most recent call last):
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/configparser.py", line 1135, in _unify_values
sectiondict = self._sections[section]
KeyError: 'blas'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configparser.py", line 168, in fetch_val_for_key
return theano_cfg.get(section, option)
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/configparser.py", line 778, in get
d = self._unify_values(section, vars)
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/configparser.py", line 1138, in _unify_values
raise NoSectionError(section)
configparser.NoSectionError: No section: 'blas'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configparser.py", line 328, in __get__
delete_key=delete_key)
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configparser.py", line 172, in fetch_val_for_key
raise KeyError(key)
KeyError: 'blas.ldflags'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configdefaults.py", line 1250, in check_mkl_openmp
import mkl
ImportError: No module named 'mkl'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ffnnecodata2.py", line 1, in <module>
from keras.layers import Input, Dense, LSTM, Activation, Dropout, Reshape
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/keras/utils/__init__.py", line 6, in <module>
from . import conv_utils
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/keras/utils/conv_utils.py", line 9, in <module>
from .. import backend as K
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/keras/backend/__init__.py", line 81, in <module>
from .theano_backend import *
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/keras/backend/theano_backend.py", line 7, in <module>
import theano
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/__init__.py", line 124, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/scan_module/scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/tensor/__init__.py", line 17, in <module>
from theano.tensor import blas
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/tensor/blas.py", line 155, in <module>
from theano.tensor.blas_headers import blas_header_text
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/tensor/blas_headers.py", line 987, in <module>
if not config.blas.ldflags:
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configparser.py", line 332, in __get__
val_str = self.default()
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configdefaults.py", line 1447, in default_blas_ldflags
check_mkl_openmp()
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/theano/configdefaults.py", line 1262, in check_mkl_openmp
""")
RuntimeError:
Could not import 'mkl'. Either install mkl-service with conda or set
MKL_THREADING_LAYER=GNU in your environment for MKL 2018.
If you have MKL 2017 install and are not in a conda environment you
can set the Theano flag blas.check_openmp to False. Be warned that if
you set this flag and don't set the appropriate environment or make
sure you have the right version you *will* get wrong results.
I'm using a conda environment and I tried to install mkl=2017 but it did not work.
I decided to translate my code to tensorflow and tried to run it again, but I got this message now:
Traceback (most recent call last):
File "tensorffnnecodata.py", line 17, in <module>
import tensorflow as tf
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/__init
.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/python
_init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/python
ywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/python
ywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/python
ywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/site-packages/tensorflow/python
ywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/imp.py", line 243, in load_modu
return load_dynamic(name, filename, file)
File "/home/powerBuilding/anaconda3/envs/tensorgpu/lib/python3.5/imp.py", line 343, in load_dyna
c
return _load(spec)
ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Do you know what is wrong with my installation?
The error suggests that you need to install cuDNN 7.0 (https://developer.nvidia.com/cudnn) for the version of Cuda you have installed from nVidia website and copy over the files to your Cuda installation folder. Prebuilt binaries of Tensorflow 1.7.0+ requires CUDA 9.0
ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory

Resources