AttributeError: module 'torch' has no attribute 'compile' - torch

I have tried using #torch.compile before the def of my function but I obtained the AttributeError: module 'torch' has no attribute 'compile' .
I have installed torchtriton as in the tutorial. Any ideas?
I do not find any clues about similar issues.

The reason is that compile is only available for PyTorch > 2.0 (https://pytorch.org/get-started/pytorch-2.0/)
Either you have to install PyTorch > 2.0 like this (but is unstable):
!pip3 install numpy --pre torch --force-reinstall --index-url https://download.pytorch.org/whl/nightly/cu117
or just delete the compile. Compile only makes the model faster, but you should be able to train the model without compile and other PyTorch versions as well.

Related

Issue installing apache-airflow-backport-providers-google module on airflow instance of Google Composer

I need execute Data Fusion pipelines from Composer, using de operatos for this:
from airflow.providers.google.cloud.operators.datafusion import (
CloudDataFusionCreateInstanceOperator,
CloudDataFusionCreatePipelineOperator,
CloudDataFusionDeleteInstanceOperator,
CloudDataFusionDeletePipelineOperator,
CloudDataFusionGetInstanceOperator,
CloudDataFusionListPipelinesOperator,
CloudDataFusionRestartInstanceOperator,
CloudDataFusionStartPipelineOperator,
CloudDataFusionStopPipelineOperator,
CloudDataFusionUpdateInstanceOperator,
)
The issue I have is about modulo "apache-airflow-backport-providers-google", with the support of this links i knew what I need to use this modulo:
reference to install the modulo in airflow instance (answered by #Gonzalo Pérez Fernández): https://airflow.apache.org/docs/apache-airflow-providers-google/stable/operators/cloud/datafusion.html
when i tried to install python dependency on Composer like PyPi Package i get this error:
UPDATE operation on this environment failed 7 minutes ago with the following error message:
Failed to install PyPI packages.
apache-airflow-providers-google 5.0.0 has requirement google-ads>=12.0.0, but you have google-ads 7.0.0. Check the Cloud Build log at https://console.cloud.google.com/cloud-build/builds/a2ecf37a-4c47-4770-9489-6fb65e87d82f?project=341768372632 for details. For detailed instructions see https://cloud.google.com/composer/docs/troubleshooting-package-installation
the log deail is:
apache-airflow-providers-google 5.0.0 has requirement google-ads>=12.0.0, but you have google-ads 7.0.0.
apache-airflow-backport-providers-google 2021.3.3 has requirement apache-airflow~=1.10, but you have apache-airflow 2.1.2+composer.
The command '/bin/sh -c bash installer.sh $COMPOSER_PYTHON_VERSION fail' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
is there any way to use de module "apache-airflow-backport-providers-google" without depedency issues on composer instance?, or What would be the best way to use data fusion operators no need to change or parse package versions in python?.
Composer Image version used:
composer-1.17.0-airflow-2.1.2
Thanks.
There is no need to install apache-airflow-backport-providers-google in Airflow 2.0+. This package actually backports Airflow 2 operators into Airflow 1.10.*. In addition, in Composer version composer-1.17.0-airflow-2.1.2 the apache-airflow-providers-google==5.0.0 package is already installed according to the documentation. You should be able to import the Data Fusion operators with the code snippet you posted as is.
However, if this is not the case, you should probably handle the conflict shown in the logs when trying to reinstall apache-airflow-providers-google==5.0.0:
apache-airflow-providers-google 5.0.0 has requirement google-ads>=12.0.0, but you have google-ads 7.0.0.
You can add the requirement for google-ads=12.0.0 in your PyPi dependencies and see if it works.

undefined reference to `sec_set_context' during mpi4py install

I am installing mpi4py using pip using the command pip3 install mpi4py, on a centos7 system.
I get this error:
/glade/u/apps/ch/opt/openmpi/4.0.5/intel/19.0.5/bin/mpicc _configtest.o -L/glade/u/apps/ch/opt/python/3.7.9/gnu/9.1.0/lib -Lbuild/temp.linux-x86_64-3.7 -Wl,--enable-new-dtags,-R/glade/u/apps/ch/opt/python/3.7.9/gnu/9.1.0/lib -o _configtest
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /opt/pbs/lib/libpbs.so.0: undefined reference to `sec_set_context'
failure.
removing: _configtest.c _configtest.o
error: Cannot link MPI programs. Check your configuration!!!
----------------------------------------
Does anybody have any tips?
In this case on Cheyenne's HPC cluster, you will likely need to add these arguments to your compilation/link commands -L/opt/pbs/lib -Wl,-rpath,/opt/pbs/lib -lsec or reload the ncarcompilers module.
Nevertheless, I recommend you reach out to CISL's helpdesk at NCAR for any similar problems you encounter on our system as there are dedicated teams of people to help users resolve issues like this.

How do you import the plone.importexport add-on correctly in plone?

i am trying to install the add-on: plone.importexport, but i found this error:
user#wppi94:~/Plone/zinstance$ bin/buildout
Unused options for buildout: 'deprecation-warnings'.
Installing instance.
Couldn't find index page for 'plone.importexport' (maybe misspelled?)
Getting distribution for 'plone.importexport'.
Couldn't find index page for 'plone.importexport' (maybe misspelled?)
While:
Installing instance.
Getting distribution for 'plone.importexport'.
Error: Couldn't find a distribution for 'plone.importexport'.
Inside the buildout.cfg eggs I wrote this:
eggs =
plone.importexport
collective.easyform
Plone
I managed to install the collective.easyform component, but I couldn't install this plone.importexport, can you tell me why it happened?
I have found the problem I have to use mr.developer to search in github. Watch this:
https://community.plone.org/t/how-do-i-install-the-plone-importexport-add-on/13698

Python/R ctypes library error: "OSError: lib/libRrefblas.so: undefined symbol: xerbla_"

Firstly, I'm a newbie R, AWS and python guy. So I'm trying to get a python script with embedded R code running in AWS Lambda using rpy2. I created a Lambda package on an EC2 instance following the instructions here (modified for using python 3.4). It seems that there is something funky happening with loading the R libs using ctypes, as per the following error received in the console:
OSError: lib/libRrefblas.so: undefined symbol: xerbla_
The test file (py_test.py) looks like this:
import os
import ctypes
for file in os.listdir('lib'):
if os.path.isfile(os.path.join('lib', file)):
ctypes.cdll.LoadLibrary(os.path.join('lib', file))
os.environ["R_HOME"] = os.getcwd()
os.environ["R_USER"] = os.path.join(os.getcwd(), 'rpy2')
os.environ["R_LIBS"] = os.path.join(os.getcwd(), 'library')
os.environ["LD_LIBRARY_PATH"] = os.path.join(os.getcwd(), 'lib')
import sys
sys.path.append(os.path.join(os.getcwd(),'rpy2'))
import rpy2
from rpy2 import robjects
def test_handler(event, context):
robjects.r('''
f <- function(r, verbose=FALSE) {
if (verbose) {
cat("I am calling f().\n")
}
2 * pi * r
}
print(f(3))
''')
test_handler(None,None)
I have lib/libRrefblas.so in my virtual environment. I have scoured google looking for answers but have come up empty. Any suggestions would be greatly appreciated!
If you can get the traceback, that could help, but I suspect the problem is that it's looking for xerbla_ in the wrong place. Is xerbla_ defined in the path to RLIBS? Maybe in libR.so?
Turns out the BLAS that ships with R is corrupt. Your best bet is to make sure that BLAS and Lapack are installed on the machine you are building R on and see if you can get it to build with those libraries instead.
So steps would be to uninstall R, then run
yum -y install lapack-devel.x86_64 lapack.x86_64
yum -y install blas -devel
yum -y install R.x86_64
Check to see if it has still installed with libRrefblas.so. If it has - try deleting that file and see if it will default to the system BLAS. If you get a error because it is still looking for libRrefblas.so
rm lib/libRrefblas.so
cp /usr/lib64/libblas.so.3 lib/
mv lib/libblas.so.3 lib/libRrefblas.so

Tracd creating Environment

I was trying to create a Tracd Environment using the following command :
trac-admin D:\My_Project initenv
I get an error saying
Import Error : No module named pkg_resources
What am I missing? I have installed Genshi and Python 2.5.2
Thanks...
Read the Trac wiki. You need setuptools, which you can download here.

Resources