trouble loading jedi-vim after install - python

My issue is possibly similar to link
but thought I'd ask jic. I'm on osx and trying to use jedi-vim. I installed jedi using pip and then jedi-vim by cloning into the dir that my vim config uses for loading packages. this one for reference. When I start vim with a python program I get the "Please install Jedi if..." message. I cloned vim 74 and configured with +python and +conceal. After still getting the error I looked into the code and found it was an import error.
As an aside, this isn't the best help message. Better might be "Unable to import jedi. Have you installed Jedi?"
I tried import jedi from within vim, as :python import jedi
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0- py2.7.egg/jedi/__init__.py", line 41, in <module>
from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0 py2.7.egg/jedi/api/__init__.py", line 16, in <module>
from jedi.parser import Parser, load_grammar
File "/usr/local/lib/python2.7/site-packages/jedi-0.9.0-py2.7.egg/jedi/parser/__init__.py", line 21, in <module>
from jedi.parser import tree as pt
ImportError: cannot import name tree
If this is a build issue, is there a good reference for building vim on mac?

Related

eppy - scripting language for E+, Energyplus

I tried to launch first commands of eppy package but I received strange errors:
from eppy import modeleditor
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from eppy import modeleditor
File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\site-packages\eppy\modeleditor.py", line 26, in <module>
from eppy.idfreader import idfreader1
File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\site-packages\eppy\idfreader.py", line 24, in <module>
from eppy.idf_msequence import Idf_MSequence
File "C:\Users\...\AppData\Local\Programs\Python\Python310\lib\site-packages\eppy\idf_msequence.py", line 27, in <module>
class Idf_MSequence(collections.MutableSequence):
AttributeError: module 'collections' has no attribute 'MutableSequence'
I noticed that maybe there are some missing files but I'm not sure. I compared my files with GitHub folder:
Screeshot:
The folder resources is missing...
I don't know if this is the problem.
I installed eppy package simply with the command: pip install eppy
Can you help me?
Thank you very much :-)
Sorry I found the issue.
The problem appears only with Python 3.10, with Python 3.9 disappears.
I don't know why...
Regarding the folder "resources" you have to download it from GitHub, because the installation with pip doesn't download it.

Tensorflow: ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found

I have been stuck on this error (for importing tensorflow) for a while, I looked on various different pages and didn't find a solution that helped. I tried installing vs 2015 as said on the internet, but that didn't work. I have downloaded python 3.8.0 rather than 3.8.2, but i still get the error. Please Help!
windows 10, latest version of tensorflow
>>> import tensorflow
Traceback (most recent call last):
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 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:\...\Python\Python38\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\...\Programs\Python\Python38\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:\...\Programs\Python\Python38\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\...\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I found a solution to my question:
Using pip:
There are system requirements that I won't bother talking about all of them as they could be found on the tensorflow website, though the 3 problems I had were that:
I didn't install Microsoft Visual C++ Redistributable for Visual
Studio 2015, 2017 and 2019.
Long paths weren't enabled
So just following a youtube tutorial didn't finish the problem. I had to download it based on the way on tensorflow's website.
Create a virtual environment in python. For the creation of a virtual environment, you need virtualenv library.
pip install virtualenv
After installing create your virtual environment.
command - virtualenv "NAME-OF-ENVIRONMENT"
eg
virtualenv myenv
This will create a directory called myenv. To activate the virtual environment you have go inside the myenv/scripts folder, open a cmd prompt and type activate.
eg
cd myenv/Scripts
activate
Get out of the Scripts folder
cd ../..
Now install TensorFlow.
pip install tensorflow
Note: Always create a virtual environment when working in any project and keep your python package clean. You can delete these environments if they become corrupt or stop working correctly due to any reason, without and fear.

How to fix import path in anaconda?

Conda of my friend stopped to work after intensive attempt to install FEniCS DOLFIN. The Anaconda had been installed in the friend's $HOME/anaconda directory (with the directory added to the $PATH). Removal of the directory and installation in a new location have not solved the problem:
$ conda info
Traceback (most recent call last):
File "/home/user/anaconda2/bin/conda", line 4, in <module>
import conda.cli
File "/home/user/anaconda2/lib/python2.7/site-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main # NOQA
File "/home/user/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/home/user/anaconda2/lib/python2.7/site-packages/conda/base/context.py", line 20, in <module>
from ..common.url import urlparse, path_to_url
File "/home/user/anaconda2/lib/python2.7/site-packages/conda/common/url.py", line 17, in <module>
from requests.packages.urllib3.util.url import parse_url
ImportError: No module named packages.urllib3.util.url
However /home/user/anaconda2/lib/python2.7/site-packages/requests/packages/urllib3/util/url.py DOES EXIST.
I have tried to inspect the sys.path (both in ipython and python). The result is:
['',
'/home/user/anaconda2/bin',
'/usr/lib/python2.7/dist-packages',
'/home/user/anaconda2/lib/python27.zip',
'/home/user/anaconda2/lib/python2.7',
'/home/user/anaconda2/lib/python2.7/plat-linux2',
'/home/user/anaconda2/lib/python2.7/lib-tk',
'/home/user/anaconda2/lib/python2.7/lib-old',
'/home/user/anaconda2/lib/python2.7/lib-dynload',
'/home/user/.local/lib/python2.7/site-packages',
'/home/user/anaconda2/lib/python2.7/site-packages',
'/home/user/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.6-py2.7.egg',
'/home/user/anaconda2/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg',
'/usr/lib/python2.7/dist-packages/IPython/extensions']
Note the 3rd (/usr/lib/python2.7/dist-packages) and last (/usr/lib/python2.7/dist-packages/IPython/extensions) element of the list. I suspect it to be the cause of trouble since in sys.path of my (working fine) Anaconda there is no reference to /usr/lib.
Also other Anaconda tools of my friend seems to be affected:
$ ~/anaconda2/bin/pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages
Cleaning up...
I have found similar (unanswered) question conda missing requests.packages.urllib3.util.url but it is unclear, what is the content of sys.path there.
There is also How to fix ImportError: No module named packages.urllib3? - but Anaconda is not mentioned there.
[EDIT]
The problem is NOT systemwide - at my account I have installed Anaconda succesfully and it works fine. No suspicious entries in sys.path too.
[EDIT]
Desperate times call for desperate measures. The problem has been fixedwalked arround with removal of friend's home directory.

Ropevim error in mac os 10.8.4

I use ropevim perfectly in Ubuntu system,
but i got lots of lots error.
i use homebrew to install macvim and python
and follow the tutorial.
http://wizardmode.com/2012/07/mountain-lion-and-homebrew-vim-importerror-no-module-named-site/
I wander know is the ropevim are very buggy or not practical in mac os system.
because the discussion is not popular?
or is there any better solution in vim for Python on mac os?
Thanks very much...it's annoying me lots of time
>>> import rope
>>> import ropevim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ropevim-0.3_rc-py2.7.egg/ropevim.py", line 10, in <module>
import vim
ImportError: No module named vim
and when I put the ropevim.vim in .vim/plugin
I will got the error when using vim
/install/ropehg/ropemode:vim la
Error detected while processing function LoadRope:
line 3:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/site-packages/ropevim-0.3_rc-py2.7.egg/ropevim.py", line 3, in <module>
import tempfile
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/tempfile.py", line 32, in <module>
import io as _io
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions
/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyInt_AsInt
Referenced from: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/
2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2
.7/lib-dynload/_io.so
I encountered a very similar stack trace when setting up some vim extensions from this page http://sontek.net/blog/detail/turning-vim-into-a-modern-python-ide
I believe the problem comes from incompatibilities between 'macport' and native python libraries, and that the native version of vim tries to pull from both.
I ultimately resolved my problem by using macport to install vim with python27 variant.
sudo port install vim +python27
The default configuration of macport's vim is without 'python' enabled.

msession not defined

I am trying to run this example program - http://pysnmp.sourceforge.net/examples/1.x/snmpbulk.html
I am on Mac OS X, and I installed pysnmp by -
$ sudo /usr/local/bin/pip install pysnmp
Now when I run the program I get -
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp import msession
ImportError: cannot import name msession
UPDATE:
seems like pysnmp 4.x doesn't have msession, so I tried http://pysnmp.sourceforge.net/examples/4.x/v3arch/index.html
and now I get -
Traceback (most recent call last):
File "pysnmptest.py", line 2, in <module>
from pysnmp.entity.rfc3413.oneliner import cmdgen
File "/Library/Python/2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 2, in <module>
from pysnmp.entity import engine, config
File "/Library/Python/2.6/site-packages/pysnmp/entity/engine.py", line 2, in <module>
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
File "/Library/Python/2.6/site-packages/pysnmp/proto/rfc3412.py", line 3, in <module>
from pysnmp.smi import builder, instrum
File "/Library/Python/2.6/site-packages/pysnmp/smi/builder.py", line 4, in <module>
from pysnmp.smi import error
File "/Library/Python/2.6/site-packages/pysnmp/smi/error.py", line 1, in <module>
from pyasn1.error import PyAsn1Error
ImportError: No module named pyasn1.error
The webpage also says they have dependencies on third-party libraries -
Latest PySNMP releases (4.x and later)
depend on the following:
ASN.1 library for Python used for
handling ASN.1 objects Python
Cryptography Toolkit used for SNMP
message authentication and encryption
How do I install them? and would it better to install from the tarball from webpage directly?
which version of pysmnp did you install? The example you're trying to run seems to be suited for the 1.x version of pysnmp.
Here I've found examples for the newest 4.x version. Note they don't use msession so I guess it was removed.
EDIT: Looks like now you have to install pyasn1 from here...
I don't use OSX so I don't know what's the better method for installing software on it. On ubuntu I just did apt-get install python-pysnmp and the whole thing was installed.
pyasn1 has been depended by pysnmp. So you could just type:
from pyasn1.error import PyAsn1Error

Categories