I have installed airflow with celery in my ec2 linux instance and airflow is working like a charm. Now when I made changes in its config file to use celery with airflow it is throwing the following error.
[2020-04-03 07:24:57,234] {settings.py:253} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=4851
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 25, in <module>
from airflow.configuration import conf
File "/usr/local/lib/python2.7/site-packages/airflow/__init__.py", line 47, in <module>
settings.initialize()
File "/usr/local/lib/python2.7/site-packages/airflow/settings.py", line 377, in initialize
configure_orm()
File "/usr/local/lib/python2.7/site-packages/airflow/settings.py", line 266, in configure_orm
engine = create_engine(SQL_ALCHEMY_CONN, **engine_args)
File "/usr/local/lib64/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 479, in create_engine
return strategy.create(*args, **kwargs)
File "/usr/local/lib64/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 87, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File "/usr/local/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 118, in dbapi
return __import__("MySQLdb")
ImportError: No module named MySQLdb
pip install MySQL-python
Should fix this
I'm using Pytorch under Ubuntu 18.04 and trying to import torchvision, but I get an error libcudart.so.9.0: cannot open shared object file: No such file or directory.
Someone could help to fix it? Thanks.
The infos below are detailed error logs:
Traceback (most recent call last):
File "/home/x/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2882, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-6dd351122000>", line 1, in <module>
import torchvision
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/__init__.py", line 1, in <module>
from torchvision import models
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/__init__.py", line 11, in <module>
from . import detection
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/detection/__init__.py", line 1, in <module>
from .faster_rcnn import *
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/detection/faster_rcnn.py", line 7, in <module>
from torchvision.ops import misc as misc_nn_ops
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/ops/__init__.py", line 1, in <module>
from .boxes import nms, box_iou
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 2, in <module>
from torchvision import _C
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: libcudart.so.9.0: cannot open shared object file: No such file or directory
import torch
import torch.nn as nn
import torchvision.transforms as transforms
Traceback (most recent call last):
File "/home/x/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2882, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-677acbcfae34>", line 1, in <module>
import torchvision.transforms as transforms
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/__init__.py", line 1, in <module>
from torchvision import models
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/__init__.py", line 11, in <module>
from . import detection
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/detection/__init__.py", line 1, in <module>
from .faster_rcnn import *
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/models/detection/faster_rcnn.py", line 7, in <module>
from torchvision.ops import misc as misc_nn_ops
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/ops/__init__.py", line 1, in <module>
from .boxes import nms, box_iou
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/x/.local/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 2, in <module>
from torchvision import _C
File "/home/x/pycharm-2019.2/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: libcudart.so.9.0: cannot open shared object file: No such file or directory
If you are using anaconda, the following may fix your problem.
conda install -c anaconda cudatoolkit==9.0
You can also try the followings.
Make sure the CUDA version is 9.0. And add the following 2 lines to ~/.bashrc.
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Then, run:
source ~/.bashrc
Add the following lines to /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64
And run:
sudo ldconfig
using anaconda, torch version is:
pytorch==1.1.0
torchvision==0.3.0
cudatoolkit=10.0
has the same problem, and fix it by changing torchvision==0.3.0 to torchvision==0.2.2
Check your CUDA version with one of these:
nvidia-smi
nvcc -V
Check your Pytorch CUDA version like this:
python
import torch
torch.version.cuda
The versions should match. Otherwise you need to either upgrade/downgrade your CUDA or do the same but for Pytorch. The error libcudart.so.9.0: cannot open shared object file: No such file or directory means that the versions don't match. You have Pytorch for CUDA 9.0, but your CUDA is another version.
To solve this install Pytorch with the correct CUDA version like this:
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
NOTE: Replace the Pytorch and the CUDA Toolkit version with the desired ones. Check the available versions here.
If applicable, rebuild your Pytorch:
rm -rf build
python setup.py develop
Try the following command
pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
I am using CUDA Version: 11.6 and this solved my error.
Source: https://github.com/pytorch/pytorch/issues/25173#issuecomment-524802888
Here's a generic solution independent from the cuda version.
The goal to set the correct path to the cuda library which is called libcudart.so.<version number>.
We find this path by sudo find / -name 'libcudart.so.<version number>'
We must add the path to the folder (not to the file) containing libcudart.so.<version number> in the .bashrc :
export LD_LIBRARY_PATH=<path to libcudart.so file>:$LD_LIBRARY_PATH
I am trying to execute my python script which imports globally installed modules through pip. (Module like nltk)
Below is my code.
interpreter.execfile("/home/roy/eclipse-workspace/geospatial-analysis/src/main/resources/wordnet_util.py");
PyObject someFunc = interpreter.get("get_similarity");
PyObject result = someFunc.__call__(new PyString("Apple pie."), new PyString("Banana pie."));
Double realResult = (Double) result.__tojava__(Double.class);
I have added the path for python modules like,
import sys
sys.path.append("/usr/local/lib/python2.7/dist-packages")
But I get the following error,
*sys-package-mgr*: can't create package cache dir, '/usr/local/lib/python2.7/dist-packages/cachedir/packages'
Exception in thread "main" Traceback (most recent call last):
File "/home/roy/eclipse-workspace/geospatial-analysis/src/main/resources/wordnet_util.py", line 6, in <module>
from nltk import word_tokenize, pos_tag
File "/usr/local/lib/python2.7/dist-packages/nltk/__init__.py", line 18, in <module>
from __future__ import print_function, absolute_import
ImportError: No module named __future__
Update:
I added sys.path.append("/usr/lib/python2.7") to the python file. It solved the above error. Now it can't find select module.
ImportError: No module named signal
I just installed nltk and now it's not working, and I need assistance figuring out what's wrong.
I followed the install guide here [https://pythonprogramming.net/tokenizing-words-sentences-nltk-tutorial/][1]
Installed via pip
sudo pip install nltk
Then I launched python and downloaded all components
# python3
>>> import nltk
>>> nltk.download()
This worked, and it downloaded all the components(I chose all). After which I figured I was good to go. However, then I went to write my first script and it errored out on the 1st line which imported nltk.
Now when I open the python interpreter I get
# python3
>>> import nltk
"2016-03-02 04:34:03,630","regex.py","ERROR","There is a problem with your SQL query: SELECT regex, regex_id FROM regex WHERE type = 'date'"
Traceback (most recent call last):
File "/home/nick/booze-dev/regex.py", line 10, in <module>
cursor.execute(SQL) # Execute SQL
NameError: name 'cursor' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/nltk/__init__.py", line 128, in <module>
from nltk.chunk import *
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/api.py", line 15, in <module>
from nltk.chunk.util import ChunkScore
File "/usr/local/lib/python3.4/dist-packages/nltk/chunk/util.py", line 13, in <module>
from nltk.tag.mapping import map_tag
File "/usr/local/lib/python3.4/dist-packages/nltk/tag/__init__.py", line 63, in <module>
from nltk.tag.sequential import (SequentialBackoffTagger, ContextTagger,
File "/usr/local/lib/python3.4/dist-packages/nltk/tag/sequential.py", line 25, in <module>
from nltk.classify import NaiveBayesClassifier
File "/usr/local/lib/python3.4/dist-packages/nltk/classify/__init__.py", line 98, in <module>
from nltk.classify.textcat import TextCat
File "/usr/local/lib/python3.4/dist-packages/nltk/classify/textcat.py", line 47, in <module>
import regex as re
File "/home/nick/booze-dev/regex.py", line 14, in <module>
sys.exit("Aborting script execution")
NameError: name 'sys' is not defined
I didn't get that error the 1st time I ran the import and executed nltk.download(), so I'm not understanding why I'm getting it now.
I've tried executing python as root and my normal user, and get the same error.
If I check my sys.path
>>> import sys
>>> sys.path
['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
I can find nltk under /usr/local/lib/python3.4/dist-packages:
# ls /usr/local/lib/python3.4/dist-packages | grep nltk
nltk
nltk-3.1.egg-info
So it should be available. So why am I getting an error when importing now?
I want to invoke a database with Django ORM. I have this problem:
*#*:~/standAlone$ python manage.py sql MyApp
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/*/django/core/management/__init__.py", line 443, in execute_fr om_command_line
utility.execute()
File "/home/*/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/*/django/core/management/__init__.py", line 261, in fetch_comm and
klass = load_command_class(app_name, subcommand)
File "/home/*/django/core/management/__init__.py", line 69, in load_comman d_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/*/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/*/django/core/management/commands/sql.py", line 4, in <module>
from django.core.management.sql import sql_create
File "/home/*/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/home/*/django/db/__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/home/*/django/utils/functional.py", line 184, in inner
self._setup()
File "/home/*/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/home/*/django/conf/__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings '{{ project_name }}.settings' (Is it on s
Is that {{ project_name }}.settings an artefact of the way you copy/pasted the code? Or is {{ project_name }} really in your manage.py file? That would explain the error. Probably left over from generating the project with some tool?
Alternatively, what's your django settings environment variable set to (django < 1.4). Or, what's the corresponding os.environ['...'] setting in your manage.py (if you use django 1.4)?