Installing mysql: No libmysqlclient.18.dylib (OS X) - python

I have installed mysql and MySQLdb but my computer doesn't have libmysqlclient.18.dylib however, there is a libmysqlclient.20.dylib.
What can I do to fix this problem?
There are some questions that suggest to create a link but I don't have file named libmysqlclient.18.dylib how to create the necessary link?

Usually installing packages using package managers like homebrew fixes such problems. In your case, installing mysql using brew may fix the problem.
brew install mysql
This way, creates needed filesystem links and therefore python packages work well.
BTW, you can upgrade the python package to match installed mysql binaries.

Ok, I managed to fix it. I think I may have installed mysql5.7.x, but, mysql5.7.x had libmysqlclient.18.dylib. Now, after I installed mysql5.6, the problem is gone!
Steps I took to solve this problem:
brew uninstall mysql
brew update
brew tap caskroom/versions
brew install homebrew/versions/mysql56

Related

CQLSH ImportError: cannot import name ensure_str

I have installed Cassandra database on my CentOs system. after that, I tried to install the Cqlsh package using this command sudo yum install cqlsh and it has been installed successfully. but when I tried to run cqlsh from the terminal, the following error appears:
ImportError: cannot import name ensure_str
somewhere in the code, it tries to load a library named six that contains ensure_str. the error does not say that it can not find a module named six, the python interpreter can find the library but can not import it!
I have tried googling but none of the solutions worked for me.
after a few hours of googling and struggling with the code, finally, I find out the solution. and I'm going to share it with others.
apparently, the problem is the new version of six (v=1.7.3) which is not compatible with my system. However, Cassandra copies the last version of six into the following path:
/usr/share/cassandra/lib/six-1.7.3-py2.py3-none-any.zip
then cqlsh try to force the python interpreter to import the library from this path by adding the following lines to the code.
third_parties = ('futures-', 'six-', 'geomet-')
for lib in third_parties:
lib_zip = find_zip(lib)
if lib_zip:
sys.path.insert(0, lib_zip)
no matter if you have another version of six installed on your system, it always tries to import the library from the Cassandra folder.
So, I have just deleted these lines from cqlsh file using this command:
vim /usr/bin/cqlsh
Then I try to install the last compatible version on six using this command:
yum install six
That's it! problem solved and now I'm using cqlsh without any problem.
I hope it helps others.
We've had reports of this being a problem on CentOS specifically with version 6.7 but it possibly affects the 7.x releases too.
It appears that the wrong Python is getting called. This isn't strictly a Cassandra issue but a problem with the Python on the machine. You can verify which Python gets run with:
$ which python
As a workaround, you should be able to run cqlsh using the system Python as follows:
$ /usr/local/bin/python /usr/bin/cqlsh
Cheers!
Use pip3 to install or upgrade to the current six.
Edit a copy of cqlsh. Change
third_parties = ('futures-', 'six-', 'geomet-')
to
third_parties = ('futures-', 'geomet-')
Not proud, but it worked.
Used pip3 to install, and found this issue as well.
For me, removing six dependencies from /usr/lib/python3/dist-packages was the only thing that worked.
rm six-1.11.0.egg-info and rm -r six-1.11.0.egg-info
I couldn't uninstall it with pip3, so manual removal was the way to go, followed by a pip3 install six
Once that was back in place, cqlsh ran without issue.
The previous answers didn't work for me, I had to delete the Cassandra included six package, and then cqlsh used the system-wide package.
mv /usr/share/cassandra/lib/six-1.7.3-py2.py3-none-any.zip /usr/share/cassandra/lib/six-1.7.3-py2.py3-none-any.zip.bak
Maybe an older version of Cassandra installed, and a newer version of cqlsh?
https://community.datastax.com/questions/12085/unable-to-connect-to-cqlsh.html

How to install modules with Python 2.4.3

I could not find anything on google about installing modules on this particular version 2.4.3 so I'm asking here.
I need to install python-ssl to use ssl package with python 2.4.3
I do not have any Scripts/pip.exe in my Python24 folder...
I've tried most commands yum / pip etc... nothing seems to work.
How to proceed please ?
You would probably need to make use of one of ancient methods of installation. Try download ssl file from PyPI, unpack it, go to catalog which was created when you unpacked it and do python setup.py install.

pip3 crashes on macOS

I've just upgraded to macOS Catalina, I've used brew install dpkg, and homebrew decided it was time to run brew cleanup.
After running it, I've not been able to run pip3 anymore.
Tried running brew doctor and brew reinstall python3, but none helped.
Running pip3 outputs this:
[1] 26346 abort pip3
I meet the same problem, and i found the solution for this problem, you can check this comment in github, it's works for me.
I found something that may be helpful!
The asn1crypto python package imports libcrypto. I removed this package from my site packages /usr/local/lib/python3.7/site-packages and now pip3 works
It turns out brew uninstall python3 does not really uninstalls it, had to remove /usr/local/lib/python3 to really remove the installation, and then reinstall python using brew install python3
The solution to libcrypto complaining about using unversioned dylib from r.xuan that Marcos linked to seems like the best workaround for now. The steps in a bit more fool-proof fashion can be found in this SO answer.

Where does pip install its modules? What if using a virtualenv? Also getting an error setting up mod_wsgi

I am new to Python and there are some things which I am not able to apprehend. Questions may seem like very kiddish, so bear with me.
As you know, Ubuntu comes with an outdated Python version. I wished to use the latest python. But since it is recommended not to override the system's python, I installed virtualenv.
I installed pip first, using sudo apt-get install python-pip.
Then installed virtualenv, using sudo pip install virtualenv, and did all the configurations required to link it to the latest python.
The questions which I want to ask are-
Where does the command pip install <module> store the module in the system? I am asking this question because there is a section in this link, which says "Installation into Python". I was confused by this, thinking whether installing a python module is sensitive to which python version I am using. If it is so, then where does pip install the module if I am using virtualenv and otherwise.
I have manually installed Apache HTTP Server 2.4.23 using this link. While installing mod_wsgi using command sudo pip install mod_wsgi, I am getting this error
RuntimeError: The 'apxs' command appears not to be installed or is not
executable. Please check the list of prerequisites in the
documentation for this package and install any missing Apache httpd
server packages.
I searched for it and the solution is to install developer package of Apache. But the problem is that I am not able to find it anywhere on it's site. I want to install it manually. What to do? Also, If I install it through sudo apt-get install apache2-dev, Will there be any difference ?
Note: As mentioned on this link, I have already set the value of APXS environment variable to the location of apxs script, which is /usr/local/apache/bin/apxs.
Concerning 1., if I have well understood, you would like to have the last 2.7 or 3.5 Python version on your distribution. Actually, you can have multiple python distribution on your distribution. I would suggest you to have a look on conda/anaconda (https://www.continuum.io/downloads) : it is very powerful and i think it would better suit you than virtualenv: virtualenv would enable you to create a separate python environnement, but it would not install a newer version of Python.
Concerning 2, I am not an expert in Apache2, but I would have used apt-get instead of re-compiling apache. While compiling, you may need some dependancies to build the mod_wsgi module. So I think it is way more easy to use the pre-built packages from your ubuntu.

Version error after pip installing MySQL-python on OSX

I have successfully installed MySQL-python to my virtual environment, confirmed by the fact that PyCharm can import it. I am however getting this message:
ImportError: this is MySQLdb version (1, 2, 4, 'beta', 4), but _mysql is version (1, 2, 5, 'final', 1)
My installation method has been:
Activate my venv in the terminal
export PATH=$PATH:/usr/local/mysql/bin
export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments
pip install MySQL-python
Which returns a successful build. I really don't understand what the problem is, is pip serving me a corrupted directory?
I tried resolving this by googling and the likes to no avail. I then tried downloading version 1.2.4b4 from sourceforge and built it within the venv. This gives me the following error:
ld: warning: ignoring file /usr/local/Cellar/mysql/5.6.19/lib/libmysqlclient_r.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/mysql/5.6.19/lib/libmysqlclient_r.dylib
I have run file $(which ) on mysql and python, returning a 64 bit build for mysql and both a 32 and 64 bit build for python.
I really have no idea what to do next, I would really appreciate some help, let me know if I've missed something! Thank you
EDIT:
I pip uninstalled MySQL-python and tried again with this zip: https://pypi.python.org/pypi/MySQL-python/1.2.5
pip install -Iv https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
Which gave me the same error as before, stating MySQLdb is version 1.2.4b4 but _mysql is 1.2.5. This leads me to believe I might have a lingering version of MySQL-python that isn't being uninstalled. How would I go about testing this? Thanks!
A couple of common potential issues:
make sure your path is right and that pip and python refer to the same interpreter. Virtual environments are best activated by doing source activate <NAME> or prepending them to the path instead of appending.
I had multiple issues with MySqlSB and stack overflow is full of questions about it. All my problems went away when I switched to pymysql, whose API is fully compatible with mysqldb. Even better, there is a method install_as_MySQLdb() which makes pymysql appear exactly like mysqldb, so all packages the expect the latter work with the former.
The procedure that I use to get set up on OSX is:
get rid of all Python installations (system python, home-brew, etc)
brew install mysql gcc. gcc is in case you want to compile c/fortran extensions to python modules.
Watch for permission errors- always run brew doctor
install anaconda
set up a virtual environment conda create -n <NAME> python=3.4
activate virtual environment source activate <NAME>
install required packages, trying conda first and pip if the package isn't there. For example, I always do conda install numpy so I don't have to compile it myself, and I do pip install pymysql
Thanks for the above answer, good advice for future troubleshooters. I managed to solve this by re-installing the 1.2.5 build and restarting my compiler.
In other words, the method I outlined above should work. For future reference make sure your bin/activate and bin/pip have their paths set to your venv and not someone else on your developer team

Categories

Resources