Trying to build code with a current pytorch under conda fails with the following error:
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Steps to reproduce the behavior:
On Ubuntu 16.04 x64, download and install anaconda
Create an environment and install pytorch there: conda install -c pytorch pytorch
./make.sh
part.ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
error./make.sh
building all the code cleanly
Collecting environment information...
PyTorch version: 1.0.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176OS: Ubuntu 16.04.5 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
CMake version: version 3.13.20181022-g64947Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 7.5.17
GPU models and configuration: GPU 0: GeForce GTX 750 Ti
Nvidia driver version: 410.79
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_static_v7.aVersions of relevant libraries:
[pip] Could not collect
[conda] Could not collect
Take a look at https://pytorch.org/tutorials/advanced/cpp_extension.html
so there is no easy solution to this? it looks like it requires a full revamp of the code that used to work for pytorch <= 0.4.1
Unfortunately yes. An example port of some other ffi code is at https://github.com/pytorch/audio/commit/8a41ecdc1ba365fb9d51e12b8ab793bc2a3f67fa but some rewriting is necessary. Let us know if you need help.
damn, weeks of work to the trash...
do you plan on deprecating such low-level stuff on a regular basis or is it really worth it trying to make a cpp extension now ?
@aliutkus we deprecated the feature after 1.5 years, and we really apologize for not having a structured deprecation path for it (it was technically not possible). We dont plan to deprecate any public API on a regular basis, especially without deprecation warnings over a few releases. This was a special case, and we apologize.
ok, great. Well I guess it's time to switch from C to C++ =)
thanks for all the work
You should change it as "import torch.utils.cpp_extension"
The problem is related to the version of pytorch you installed. I reduced its version from 1.0 to 0.4, and the problem is solved. Newer is not better!
I am using torch version 1.4.0 but I got the same issue how can I solve it?
Same, I tried import torch.utils.cpp_extension
, but no dice.
Most helpful comment
The problem is related to the version of pytorch you installed. I reduced its version from 1.0 to 0.4, and the problem is solved. Newer is not better!