ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None - theano

C:\Users\meela\Anaconda3\python.exe E:/TTIGAN/test.py
You can find the C code in this temporary file: C:\Users\meela\AppData\Local\Temp\theano_compilation_error_zncbj7_k
Traceback (most recent call last):
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 81, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 105, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/TTIGAN/test.py", line 1, in <module>
import skipthoughts
File "E:\TTIGAN\skipthoughts.py", line 6, in <module>
import theano
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\vm.py", line 674, in <module>
from . import lazylinker_c
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 140, in <module>
preargs=args)
File "C:\Users\meela\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2388, in compile_str
(status, compile_stderr.replace('\n', '. ')))
.
Process finished with exit code 1

Same problem here, solved by installing a mingw-w64 import library for python(on Windows via conda) in your CLI type:
conda install -c anaconda libpython

I had the same problem, got me 2 days to resolve!
It was from path environment, i had another mingw path imported in variables and i removed it!

I had the same issue on my Mac. Installing theano via pip should fix this issue.
pip install theano

I had the same problem, it was caused by an old version of anaconda from 2014 that I forgot I even had. Just renaming the old directory fixed the problem.

The solution that worked for me was to uninstall my MinGW gcc compiler and reinstall the latest one. Make sure to restart your CLI before testing it.

Related

'Invalid syntax' error when importing torch (Linux)

I'm trying to install torch under miniconda and simple import torch gives me the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/vol/tcm17/username/miniconda3/lib/python3.8/site-packages/torch/__init__.py", line 779, in <module>
from .serialization import save, load
File "/vol/tcm17/username/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 18, in <module>
from typing_extensions import TypeAlias
File "/home/username/.local/lib/python3.8/site-packages/typing_extensions.py", line 880
if stripped_args
Interestingly, if I repeat import torch again the error message changes:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/vol/tcm17/username/miniconda3/lib/python3.8/site-packages/torch/__init__.py", line 249, in <module>
for name in dir(_C):
NameError: name '_C' is not defined
I'm not using notebooks, python version is 3.8.16, pytorch version is 1.13.1. Miniconda is installed in a local folder (it's a university server so I can only do it like this due to disk space restrictions), the server runs on Ubuntu.
What could possibly be the problem?
The only recommendation I found for similar problems is to install Cython but it didn't help.
Downgraded to python 3.6 and this somehow solved the problem.

ImportError DLL load failed while importing fasttext_corpusfile

When I try to import gensim, I get the below error:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\gensim\models\fasttext.py", line 264, in <module>
from gensim.models.fasttext_corpusfile import train_epoch_sg, train_epoch_cbow
ImportError: DLL load failed while importing fasttext_corpusfile: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\gensim\__init__.py", line 11, in <module>
from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils # noqa:F401
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\gensim\models\__init__.py", line 22, in <module>
from .fasttext import FastText # noqa:F401
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\gensim\models\fasttext.py", line 266, in <module>
raise utils.NO_CYTHON
RuntimeError: Compiled extensions are unavailable. If you've installed from a package, ask the package maintainer to include compiled extensions. If you're building Gensim from source yourself, install Cython and a C compiler, and then run `python setup.py build_ext --inplace` to retry.
My computer is Windows Server 2022 Data Center, python is 3.8.10, gensim is 4.2.0.
How can I solve this problem? Thank you for your help.
I re-installed gensim (gensim-4.2.0-cp39-cp39-win_amd64.whl) from https://pypi.org/project/gensim/#files, but still had the above problem.

distutils.util missing after upgrading to 3.8

I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that python3-disutils is installed. /usr/lib/python3.8/distutils looks fine, just not getting picked up for some reason.
One thing I noticed is that in the traceback below, it's using the system-wide pip, while I have a later version of pip installed under my .local. I don't know if those two symptoms are related but looks like I'm missing some config somewhere so none of the 3.8 or user space stuff is picked up.
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pip/_internal/main.py", line 14, in main
from pip._internal.utils.entrypoints import _wrapper
File "/usr/lib/python3/dist-packages/pip/_internal/utils/entrypoints.py", line 3, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I have the same issue on Debian Bullseye (or rather mixed Bullseye/Buster).
Package python3-distutils (3.8.6) contains module for Python 3.8 and 3.9 (!).
Old package (3.7.3) for Python 3.7. You have to choose.
My workaround is just copy module.
mkdir -p /usr/lib/python3.7/distutils
cp -a /usr/lib/python3.8/distutils/* /usr/lib/python3.7/distutils/

unable to run a python file because of Module not found error despite sourcing the pythonpath

I have been trying to run a python file using rosrun command but unfortunately I am having this module not found error because of a package named rospkg. Until a day before yesterday, it was all working fine but yesterday, ubuntu18.04 has got some updates out of which an update for ubuntu base was also present, since that update I am having this error.
I have tried to check whether I have installed the respective python-rospkg and its says I already have the latest version. I have also using
echo $PYTHONPATH
to check the sourced paths and they are sourced correct, I am not sure whats causing this error.
the error is as follows
Traceback (most recent call last
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py",
line 5, in <module>
import roslib
File "/opt/ros/melodic/lib/python2.7/dist-
packages/roslib/__init__.py", line 50, in <module>
from roslib.launcher import load_manifest
File "/opt/ros/melodic/lib/python2.7/dist-
packages/roslib/launcher.py", line 42, in <module>
import rospkg
ModuleNotFoundError: No module named 'rospkg'
The shebang for my is as follows,
#!/usr/bin/python3
When i try to run the file by changing the shebang to
#!/usr/bin/python2.7
I get the following error
Traceback (most recent call last):
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py",
line 3, in <module>
import tensorflow as tf
ImportError: No module named tensorflow
I have installed tensorflow version 1.14 using pip installation. Can anyone please help me solving this error. Thanks in advance
edit:
I have manually tried to set the python path to /usr/lib/python2.7/dist-packages as when I tried to install python-rospkg, it says the its already instaled in that location. Doing that I am having error importing tensorflow and the error is
`Traceback (most recent call last):
File
"/home/microbot/catkin_ws/src/spider/spider_control/control.py", line
3, in <module>
import tensorflow as tf
File "/home/microbot/.local/lib/python3.6/site-
packages/tensorflow/__init__.py", line 22, in <module>
import inspect as _inspect
File "/usr/lib/python3.6/inspect.py", line 41, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:`

Theano Import Error, python 3.6 windows 10

I'm trying to import theano and I'm getting an import error.
I've seen common issues with theano relate to not having g++, mingw, or libpython installed. I can confirm I have all three installed. g++ 4.7.0, mingw 4.7, libpython 2.1, and theano 1.0.1.
Any suggestions on what to chase down next? I'm a little stumped.
When I run a simple python (3.6) file trying to import theano I get the following:
You can find the C code in this temporary file: C:\Users\CAVEJO~1\AppData\Local\Temp\theano_compilation_error_1b3hfusl
Traceback (most recent call last):
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
raise ImportError()
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\Projects\Pandas\housing_prices.py", line 4, in <module>
import theano
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\__init__.py", line 110, in <module>
from theano.compile import (
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
from theano.compile.mode import *
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\vm.py", line 673, in <module>
from . import lazylinker_c
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
preargs=args)
File "C:\Users\Cave Johnson\AppData\Local\Programs\Python\Python36-32\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): The system cannot find the path specified.
.
I had the same issue, and it came down to missing dependencies.
This seemed to be the key for me:
conda install numpy scipy mkl-service libpython m2w64-toolchain
conda install -c conda-forge blas
See https://github.com/Theano/Theano/issues/6532 or more details.

Resources