I have try to import numpy in simulator Webots(7.0.3), it's successful to be used until several times that supervisor revert the simulation. It comes out these error message:
Traceback (most recent call last):
File "PyController.py", line 39, in <module>
from numpy import *
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 170, in <module>
from . import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 11, in <module>
from . import numeric
File "C:\Python27\lib\site-packages\numpy\core\numeric.py", line 1103, in <module>
os.environ.update(envbak)
File "C:\Python27\lib\os.py", line 461, in update
self[k] = dict[k]
File "C:\Python27\lib\os.py", line 422, in __setitem__
putenv(key, item)
ValueError: the environment variable is longer than 32767 bytes
The revert function is an original function for supervisor robot which can be called in Webots simulator:
supervisor.simulationRevert()
Can any body help me with this problem? Thanks!
Related
I tried below code:
import transformers
and got below error:
import transformers
File "C:\Users\user1\AppData\Roaming\Python\Python37\site-packages\transformers\__init__.py", line 22, in <module>
from .integrations import ( # isort:skip
File "C:\Users\user1\AppData\Roaming\Python\Python37\site-packages\transformers\integrations.py", line 58, in <module>
from .file_utils import is_torch_tpu_available
File "C:\Users\user1\AppData\Roaming\Python\Python37\site-packages\transformers\file_utils.py", line 156, in <module>
import sklearn.metrics # noqa: F401
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\metrics\__init__.py", line 7, in <module>
from .ranking import auc
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\metrics\ranking.py", line 35, in <module>
from ..preprocessing import label_binarize
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\preprocessing\__init__.py", line 6, in <module>
from ._function_transformer import FunctionTransformer
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\preprocessing\_function_transformer.py", line 5, in <module>
from ..utils.testing import assert_allclose_dense_sparse
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\utils\testing.py", line 718, in <module>
import pytest
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\pytest.py", line 6, in <module>
from _pytest.assertion import register_assert_rewrite
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\_pytest\assertion\__init__.py", line 7, in <module>
from _pytest.assertion import rewrite
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\_pytest\assertion\rewrite.py", line 26, in <module>
from _pytest.assertion import util
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\_pytest\assertion\util.py", line 8, in <module>
import _pytest._code
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\_pytest\_code\__init__.py", line 2, in <module>
from .code import Code # noqa
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\_pytest\_code\code.py", line 23, in <module>
import pluggy
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 16, in <module>
from .manager import PluginManager, PluginValidationError
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\pluggy\manager.py", line 11, in <module>
import importlib_metadata
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 547, in <module>
__version__ = version(__name__)
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 509, in version
return distribution(distribution_name).version
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 482, in distribution
return Distribution.from_name(distribution_name)
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 183, in from_name
dist = next(dists, None)
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 425, in <genexpr>
for path in map(cls._switch_path, paths)
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 449, in _search_path
if not root.is_dir():
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\pathlib.py", line 1358, in is_dir
return S_ISDIR(self.stat().st_mode)
File "C:\Users\user1\AppData\Local\Continuum\anaconda3\lib\pathlib.py", line 1168, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\user1\\Spark\\python\\lib\\py4j-0.10.8.1-src.zip:C:\\Users\\user1\\Spark\\python'
So, here is the error:
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\user1\Spark\python\lib\py4j-0.10.8.1-src.zip:C:\Users\user1\Spark\python'
This is happening only for transformers package and rest like pandas or numpy or torch give no issues.
I see quite a few links giving solutions to this error, but more appear related to syntax of the code (like using double quotes or having an additional backlash).
What am I missing? Thanks in advance for any help.
I am still not sure of the reason for the error, but I could overcome the same by creating an environment and then installing transformers in it.
Hope this will help someone stuck with same error
I am using Spyder 3.3.2 and scikit-learn Version: 0.20.1. I am running a script that starts importing DBSCAN by:
from sklearn.cluster import DBSCAN
The first two times I run the script, it works ok. However,the third time I invariably get:
Traceback (most recent call last):
File "<ipython-input-3-f629b84de3e3>", line 1, in <module>
runfile('/home/mario/Documents/python_machine_learning_projects/test_for_question.py', wdir='/home/mario/Documents/python_machine_learning_projects')
File "/home/mario/.local/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 704, in runfile
execfile(filename, namespace)
File "/home/mario/.local/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 100, in execfile
builtins.execfile(filename, *where)
File "/home/mario/Documents/enerchemtek/python_machine_learning_projects/test_for_question.py", line 9, in <module>
from sklearn.cluster import DBSCAN
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/cluster/__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/cluster/spectral.py", line 15, in <module>
from ..metrics.pairwise import pairwise_kernels
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/metrics/__init__.py", line 7, in <module>
from .ranking import auc
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/metrics/ranking.py", line 36, in <module>
from ..preprocessing import label_binarize
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/preprocessing/__init__.py", line 6, in <module>
from ._function_transformer import FunctionTransformer
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/preprocessing/_function_transformer.py", line 5, in <module>
from ..utils.testing import assert_allclose_dense_sparse
File "/home/mario/.local/lib/python2.7/site-packages/sklearn/utils/testing.py", line 54, in <module>
from nose.tools import raises as _nose_raises
File "/home/mario/.local/lib/python2.7/site-packages/nose/__init__.py", line 1, in <module>
from nose.core import collector, main, run, run_exit, runmodule
File "/home/mario/.local/lib/python2.7/site-packages/nose/core.py", line 11, in <module>
from nose.config import Config, all_config_files
File "/home/mario/.local/lib/python2.7/site-packages/nose/config.py", line 9, in <module>
from nose.plugins.manager import NoPlugins
File "/home/mario/.local/lib/python2.7/site-packages/nose/plugins/__init__.py", line 185, in <module>
from nose.plugins.manager import *
File "/home/mario/.local/lib/python2.7/site-packages/nose/plugins/manager.py", line 418, in <module>
import pkg_resources
File "/home/mario/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 55, in <module>
from pkg_resources.extern import six
File "/home/mario/.local/lib/python2.7/site-packages/pkg_resources/extern/__init__.py", line 44, in load_module
mod = sys.modules[extant]
AttributeError: 'NoneType' object has no attribute 'modules'
If I run the script in a terminal by doing:
python MyScript.py
it all works ok, so it must be a problem with Spyder. Also, the error is replicated if I run a script that contains only that line of code.
Thanks in advance !
I am a windows user. I used the command pip install requests to have requests installed, and I also typedpip install urllib3 to have urllib3 installed. However, I am not able to run this code: from requests import request. I got a error like this:
Traceback (most recent call last):
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
File "D:\Python\lib\http\client.py", line 71, in <module>
import email.parser
File "F:\eclipse\workspace\Overseascredit\email.py", line 1, in <module>
from requests import request
ImportError: cannot import name 'request'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\eclipse\workspace\Overseascredit\email.py", line 1, in <module>
from requests import request
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\__init__.py", line 60, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "D:\Python\lib\site-packages\requests-2.13.0-py3.5.egg\requests\packages\__init__.py", line 29, in <module>
import urllib3
File "D:\Python\lib\site-packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "D:\Python\lib\site-packages\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "D:\Python\lib\site-packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "D:\Python\lib\site-packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "D:\Python\lib\site-packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
File "D:\Python\lib\http\client.py", line 71, in <module>
import email.parser
File "F:\eclipse\workspace\Overseascredit\email.py", line 1, in <module>
from requests import request
ImportError: cannot import name 'request'
I saw a lot of answers saying that there is another file with duplicate name that occur this error, however, I searched through the fold, I did found one. I even reinstalled my python, but I still got this error. Please help me.
Try using
from requests import Request
instead of
from requests import request
Try to run an app on local machine through virtual environment. But run into this issues related to libssl. Have libssl.1.0.0.dylib in the reference folder so I don't know why it cannot find the method. Really appreciate anyone can give me a direction.
Traceback (most recent call last):
File "app.py", line 4, in <module>
from traffic_analytics import traffic_analytics
File "/Users/zhehaozhou/Documents/Development/giq-analytics/dashboard-x/webapp/traffic_analytics.py", line 12, in <module>
from traffic import download_ga_data as ga_downloader
File "/Users/zhehaozhou/Documents/Development/giq-analytics/dashboard-x/webapp/traffic/download_ga_data.py", line 13, in <module>
from ga import GoogleAnalytics
File "/Users/zhehaozhou/Documents/Development/giq-analytics/dashboard-x/webapp/traffic/ga.py", line 8, in <module>
from apiclient import errors
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/apiclient/__init__.py", line 19, in <module>
from googleapiclient import discovery
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/googleapiclient/discovery.py", line 66, in <module>
from oauth2client.client import GoogleCredentials
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/oauth2client/client.py", line 46, in <module>
from oauth2client import crypt
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/oauth2client/crypt.py", line 40, in <module>
from OpenSSL import crypto
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/OpenSSL/_util.py", line 7, in <module>
binding = Binding()
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 114, in __init__
self._ensure_ffi_initialized()
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 126, in _ensure_ffi_initialized
cls._modules,
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 31, in load_library_for_binding
lib = ffi.verifier.load_library()
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cffi/verifier.py", line 97, in load_library
return self._load_library()
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cffi/verifier.py", line 207, in _load_library
return self._vengine.load_library()
File "/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cffi/vengine_cpy.py", line 153, in load_library
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing '/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_f3e4673fx399b1113.so': dlopen(/Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_f3e4673fx399b1113.so, 2): Symbol not found: _SSLv2_client_method
Referenced from: /Users/zhehaozhou/anaconda/envs/virtualZhehao2/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_f3e4673fx399b1113.so
Expected in: /usr/lib/libssl.1.0.0.dylib
I am having trouble importing numpy into my project. I am using python 2.7.10 and when i try to run the script i get the error :
Traceback (most recent call last):
File "test.py", line 2, in <module>
import numpy as np
File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 58, in <module>
from numpy.testing import Tester
File "/usr/local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 14, in <module>
from .utils import *
File "/usr/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in <module>
from tempfile import mkdtemp
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions /2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/li b/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/li b/python2.7/lib-dynload/_io.so
Any ideas on whats causing the issue?