How do I use YCM after installing Anaconda? - python

Getting error: requires Vim compiled with Python (2.7.1+ or 3.4+) support.
It is installed with Python3. YCM was working great until installing Anaconda. To fix I tried adding this to my .vimrc:
let g:ycm_path_to_python_interpreter = '/usr/bin/python'
I have also referred to the YCM FAQ and tried adding this to my .ycm_extra_conf.py:
def Settings(**kwargs):
return {
'interpreter_path': '/path/to/anaconda/python'
}
However nothing has removed or changed the error.
I have recompiled with anaconda python and then redid it with normal python when that didn't work either. It seems from others who asked this question it does need to be compiled with non-anaconda python.
I have seen suggestions to remove the anaconda path from .bash_profile but doesn't that defeat the purpose of having Anaconda?
Any help would be greatly appreciated.
Solved the problem by commenting out the Anaconda path in my .bash_profile. 'which' python still points to Anaconda python, but YCM compiles and works again.
No idea why this approach works, but it does.

I couldn't compile Youcompleteme successfully, which really made me confused.
Finally I found that is caused by Anaconda. So I used the default version python to recompile it again.
$ /usr/bin/python ~/.vim/bundle/Youcompleteme/install.py
It works perfectly.

Related

The PIL library import fails

Being a complete begginer in python, I decided to install the python interpreter 3.4.4, and also PyDev plugin for eclipse IDE. I am also using windows 10.
I have encountered a problem regarding certain imports, namely : from PIL import Image, ImageTk, which is apparently an unresolved import.
I have looked at certain questions which were similar to my situation, but most of them gave a solution like installing packaged from the linux apt-get. Here are some topics I visited :
Uninstalling and reinstalling Pillow and pip,
Installing pillow-imaging-tk on Ubuntu,
This topic which left me very confused,
This one seemed helpful, but is on Unix OS again
So please, could someone explain to me why I am seeing this error, and how could I correct it if I absolutely want to use Eclipse, Pydev, windows 10 and Python 3.
Found the solution, here's what I did:
Set the PYTHONPATH like it is shown in this article, make sure python.exe is accessible via cmd,
Via cmd, type pip install pillow. Alternatively, you can enter the same command from Windows+R,
(Not sure if relevant step) Via eclipse, Windows->Preferences->PyDev->PythonInterpreterremove your interpreter to re-add it,
Restart eclipse.
For Python import problems in PyDev, the project web site has a page on interpreter configuration that is a good place to start. I recently had a similar problem that I solved by adding a module to the forced builtins tab.

pycharm error while importing, even though it works in the terminal

I have installed the packages TensorFlow and scikit_learn and all its dependencies. When I try importing them using python 2.7.6 or 2.7.10 (I have tried both) in the terminal, it works fine. However, when I do it using pycharm it gives an error.
In the case of scikit_learn with the launcher 2.7.6 says:
ImportError: dynamic module does not define init function (init_check_build)
In the case of scikit_learn with the launcher 2.7.10 says:
ValueError: numpy.dtype has the wrong size, try recompiling
In the case of TensorFlow with the launcher 2.7.6 says:
ImportError: dlopen(/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so: mach-o, but wrong architecture
In the case of TensorFlow with the launcher 2.7.10 says:
ImportError: No module named copyreg
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
I have tried to search in the net but the solutions did not work for me. I have tried to uninstall them and install them again with pip, conda and directly the source code and it gives always the same errors. I have even tried reinstalling pycharm with no better luck.
Other libraries, such as scilab or numpy, work fine in pycharm.
Any ideas? It is just driving me mental. By the way, I am using a Mac OS 10.10.5.
you should start PyCharm from terminal
cd /usr/lib/pycharm-community/bin
./pycharm.sh
Add this 'DYLD_LIBRARY_PATH=/usr/local/cuda/lib' to Python environment variable. Run-> Edit Configurations -> Environment variables. Hope it works.
At the end, I ended up creating a virtual environment, reinstalling everything in there, and calling it through pycharm. I am not entirely sure what was the problem between conda and pycharm, I probably messed up somewhere.
I am now using a different virtual environment depending on the project and I am happier than ever :).
I had a similar problem. My code was was not working on PyCharm professional. I had PyCharm CE previously installed and it worked from there. I had configured PyCharm CE a while ago and I had forgotten what setup I used but if issues persist, make sure that the packages are installed under Preferences > Project > Project Interpreter
hey if there are people still with this problem I would like to tell you the solution. It works for me everytime.
1.Open Pycharm
2.Open PyCharmProject or the folder you are using
3.Click File and there Settings
4.Click Project: PyCharmProjects , there project interpreter
5.Select the global virtual enviroment for this ( including photo thats showing what i did )
6.Check if there are all packages you have installed

MySQLdb installation on Windows 7

I am running python 2.7 in windows 7. I'd like to link up to mysql and found MySQLdb. I have tried easy_install mysql-python and found the /Z1 error. Although I downloaded the source, I'd like to avoid having to make all the changes to avoid the Z1 error (due to the source expecting the VC compiler that i don't have). i downloaded the 1.2.4 binary and installed. however, when i start up python and try "import MySQLdb", it does not find it.
i have looked at many pages. i am sure that i am overlooking something obvious, but i am new to python and i've run around in circles at so many pages.
please help.
edit: the installation actually worked. the problem is that i must have installed a 32 bit version. it works fine in IDLE which is using python 2.7.3 32 bit. but i was trying to use ipython and spyder, both were set up as 64.
i tried to install "unofficial version" from http://www.lfd.uci.edu/~gohlke/pythonlibs/ which i got from Python: How to install mysqldb on windows 7 x64?. it claims python 2.7 is not in registry. any help here would be welcome.
I did not solve the /Z1 issue. However, i did determine what i did wrong with the binary install. i had included /python27/LIB/site-packages/MySQLdb only. once i also added /python27/LIB/site-packages/MySQL_python.1.2.4b4-py2.7.egg-info it worked. i did not verify whether i need both in the pythonpath or not. but having both does work.

Python GDal installation

Having some problems with Gdal installation with python 2.7 on Windows 7 32bit. I am running MSVC 2010. I have followed the instruction from the blog website
http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/
The installation is fine. At the end of it, I am able to run ogr2ogr in the MS-DOS and have gotten the similar screen as listed in the blog.
However, when I am trying to use the command "import osgeo" on the Python IDLE GUI shell. A series of error message is released, reading like the following
"DLL error:.........."
I believe that this might mean that the python binding is of wrong version. I have cleared up my installation by removing the following: Python-Gdal binding, Gdal, Python 2.7
After removing them, I have retried my installation with Python 3.2.3 instead and loaded the Gdal package and python binding accordingly. However, the same error returns.
Is there any intermediate steps that I could take to verify the installation. Any other advice I could have to have the bindings installed? Or is my reinstallation method correct?
I have tried to install FWTools too. It doesnt seem to work either. I have run the Python shell from EV-shell and type in "import osgeo". Have gotten the message "no module exist...."
Thanks
Get the precompiled gdal from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
I have some other notes on setting up postgres and postgis 2.0 here if you need it:
http://monkut.webfactional.com/blog/archive/2012/5/2/using-django-14-with-gdal-19-and-postgis-20/

Python Not Enabled In Vim

I am trying to get the Xdebug vim plugin to work which depends on python. Here is my environment: Windows 7 Professional 64bit, Vim 7.3. I got everything set up for this plugin, but when I hit F5 nothing happens. I found some blogs describing some additional steps to get this working on Windows. All of them stressed making sure the correct version of Python is installed correctly. I looked at the plugin code in the debugger.vim file and close to the top it checks to see if python is available and exits if it is not. I inserted an echo command to tell me if python is not installed, and sure enough a message box pops up informing me of such. Here is the modified code:
if !has("python")
echo 'python NOT loaded'
finish
endif
According to this blog http://phphints.wordpress.com/2008/08/20/add-debug-support-to-vim/ I need to install the version of python that includes the dll vim is looking for when I run the version command from vim. Mine reports:
-DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DDYNAMIC_PYTHON3_DLL=\"python31.dll\"
So I installed the 64 bit version of python 2.7.1. Same result even though python27.dll is in the System 32 folder. I also tried adding the location of python.exe to the PATH, but this did not help. I also tried installing the 64 bit version of python 3.1.3 but this did not help. Any ideas?
I made the following changes, and now python is working (The conditional echo statement is never reached). I uninstalled Vim and re-installed it. I uninstalled the 64 bit versions of Python 2.7.1 and 3.1.3. I installed the 32 bit version of python 2.7.1.
I am guessing the change that made the difference is using the 32 bit version of Python 2.7.1 since I am using the 32 bit version of Vim. What do you think(leave a comment)?
This may not be the direct solution to your problem, but you need to make sure the vim executable compiled with Python support.
You can check what options are compiled by running :version in the vim command line.
Also, as far as I know, python3 support only added after vim7.3. If you have vim7.2, your best bet is to get python 2 working.

Categories

Resources