Mac psql/readline - Library not loaded - python

I'm working on a Mac, Sierra 10.12.3, and I'm trying to access a PostgreSQL database via the psql command, but it threw the error
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/bin/psql
Reason: image not found
Abort trap: 6
A day or two ago, I was working with someone and I needed to install pip, so I ran brew install pip, and it was all good. This is the first time I'm trying to run psql since then and I'm not certain that this has anything to do with my problem, but it seems likely since I haven't made any other changes.
Now I did a little detective work and found that if I went to /usr/local/opt/ there was indeed a readline alias directory that pointed to /usr/local/Cellar/readline/7.0.1 (version 7.0.1 also seeming to have gotten installed at some point - maybe as part of pip? Maybe I did it by mistake...) so it made some sense that the original error should be thrown. I changed the alias to point to /usr/local/Cellar/readline/6.3.8 and the error changed slightly:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/bin/psql
Reason: no suitable image found. Did find:
/usr/local/opt/readline/lib/libreadline.6.dylib: stat() failed with errno=20
Abort trap: 6
So it seems like I'm getting somewhere, but still having an issue. If anyone can shed some light on a solution, I would be forever grateful.

I was able to resolve this by simply running brew switch readline 6.3.8

Readline has been upgraded but you are still using an older psql from postgres. Upgrading postgres to a current version that uses the current readline fixed the problem for me:
brew upgrade postgres

After I run brew upgrade, I also had this problem.
First, You need to confirm the version of the readline on your Mac.
In your situation, your old readline's version is 6.x. After upgrading, your readline was updated into 7.0.1. So you need to link your new readline.
These code might be helpful.
$ cd /usr/local/opt/readline/lib/ # cd to readline library
$ sudo ln -s libreadline.7.dylib libreadline.6.dylib # change the link
I think the better way is to change the system readline link, but I don't know how to change.

Related

Typing Python3 or Python3.6 is giving me an error

I am reading a book("Learn Python 3 the Hard Way") that teaches me python 3.6 but I am unable to get python 3.6 running on the terminal. The book specifically says "In your Terminal program, run python3.6. You run things in Terminal by just typing the name and hitting RETURN." I already installed python 3.6 and Atom but typing in python3.6 is giving me an error.
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python
Reason: image not found
Abort trap: 6
I have tried just typing in "python" but it defaults to 2.7. Please help because I am super confused and I have no idea what I'm doing. Thank you.
Looks like a known bug; Python versions older than 3.7 do not work on Big Sur.
You should just use the homebrew to install the python or the other packages, it's simpler and doesn't really hampers the underlying versions of python.
If you want to remove the previous versions or unwanted versions from you system https://stackoverflow.com/a/3819829/13176117 this is the best answer that i follow every time.

Pip is hanging when I try install anything, for hours. How can I fix this?

I have downloaded and installed the latest version of Anaconda v5.1. I have previously uninstalled / deleted all previous versions of python / Anaconda / pip the cache etc that I could find on the computer, Windows 10 and I am still getting this problem. I wasn't getting it before.
Typically what happens is the output you would normally see when installing a module but pip then hangs after the "Successfully installed XXX" message. I have to cancel the process with "Ctrl + C". If I try to import the module I just installed I get the message "No module named: XXX"
What can I do to solve this problem?
Ok I'm not sure what the issue really was, but I was able to resolve it. It seems to have been comodo antivirus. As I came accross other persons with a similar problem and they had comodo installed.
I removed comodo and the issue seems to have been resolved. It may have had something to do with the following file:
C:\Users\\AppData\Local\pip\cache\selfcheck.json
It seems like pip is trying to lock the file and is stuck in an infinite loop trying to achieve a lock.
I have also found that disabling the auto-containment on comodo also allows pip to function.

error about libpl (shared) when using pyswip (mac)

I got the error libpl (shared) not found.(see below for details) when using pyswip (mac). I know there is a question about it posted several years ago, but it is not solved. I installed swiprolog(>7.0.0) with homebrew and run 2to3 for pyswip. Help me.
PS: I am learning logic programming, I need it.
libpl (shared) not found. Possible reasons: 1) SWI-Prolog not
installed as a shared library. Install SWI-Prolog (5.6.34 works just
fine) An exception has occurred, use %tb to see the full traceback.
The error is thrown here.
# UNIX-like
try:
_lib = CDLL("libpl.dylib")
except IndexError:
# let's try the cwd
_lib = CDLL("./libpl.so")
I finally found a solution: pyswip does not support SWI-Prolog 8.x.x and the only SWI-Prolog version that has worked for me is Homebrew's swi-prolog 7.6.4 (latest 7.x.x stable release). Because Homebrew does not keep track of different versions of swi-prolog, I had to really dig to find the old 7.6.4 "formula". Now it works with the current version of pyswip (0.2.8).
TL; DR: Remove your current SWI-Prolog install (and remove any associated PATH editing), do brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/09a94009142a6265b0b8e322463100610aeda964/Formula/swi-prolog.rb and call it a day.
EDIT:
Caveat: This approach will not let you use some Prolog packages such as library(process) and library(http/json). To correct this, you can install the macOS app and manually install and relink the libncurses.6.dylib in order for PySwip to be able to find it, like this:
brew install ncurses # Specifically install this library
sudo find / -name "libncurses.6.dylib" # You'll see an entry in /usr/local/Cellar/ncurses/6.1/lib/libncurses.6.dylib or something like that in /.../Cellar/ncurses/ (Homebrew folder)
# Now go relink the libswipl.dylib to depend on the newly installed `ncurses` library
cd /Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0 # The "darwin" version may vary depending on your OS/SWI-Prolog version
# You'll see that it is linked against a fake /opt/local/lib/libncurses.6.dylib which doesn't in fact exist
otool -L libncurses.6.dylib
# Now check the top-level lib, libswipl.dylib, it should show a "#executable_path/../swipl/lib/x86_64-darwin15.6.0/libncurses.6.dylib" or something like that depending on your version.
otool -L libswipl.dylib
# Now replace the fake with the real by actually modifying the top-level lib, libswipl.dylib. Contrary to intuition, the way linking works in macOS is that you can only modify the depending library, so libswipl.dylib instead of libncurses.6.dylib.
install_name_tool -change #executable_path/../swipl/lib/x86_64-darwin15.6.0/libncurses.6.dylib /usr/local/Cellar/ncurses/6.1/lib/libncurses.6.dylib libswipl.dylib
# Now you'll see that libswipl.dylib has been successfully modified:
otool -L libswipl.dylib

dyld: Library not loaded: /usr/local/libodep/lib/libintl.8.dylib

I want to use unoconv with LibreOffice 4.2, but it seems like I can not start the python of LibreOffice.
When I run
/Applications/LibreOffice.app/Contents/MacOS/LibreOfficePython.framework/Versions/3.3/Resources/Python.app/Contents/MacOS/LibreOfficePython -v
The error is:
dyld: Library not loaded: /usr/local/libodep/lib/libintl.8.dylib
Referenced from: /Applications/LibreOffice.app/Contents/MacOS/LibreOfficePython.framework/Versions/3.3/Resources/Python.app/Contents/MacOS/LibreOfficePython
Reason: image not found
Trace/BPT trap: 5
Not directly an answer to the original question, but I ended up on this page after searching for the same error message, while running gpg. Turns out gettext was mangled during upgrade of ios. The following sorted it:
brew install gettext
brew link gettext --force
I just ran into the same issue. The fix is ugly, but essentially follows Michael's approach. The lib is provided by MacPorts and installed there:
> find /opt/ -name 'libintl*'
/opt/local/include/libintl.h
/opt/local/lib/libintl.8.dylib
...
A simple softlink into /usr/ does the trick, but gee do I dislike polluting trees like this!
> sudo bash
> mkdir -p /usr/local/libodep/lib
> ln -s /opt/local/lib/libintl.8.dylib /usr/local/libodep/lib/libintl.8.dylib
With this, the Python 3.3 from LibreOffice runs. I sure hope that somebody at LibreOffice is going to fix this. Anybody know if a bug has been filed?
The library it's attempting to load isn't a standard dylib on MacOS. Whoever created LibreOffice should have either included the dylib in their app package somewhere or they should have included instructions on how to set things up properly for LibreOffice.
From what I can tell, it looks like you need to install MacPorts in order to pick up libintl.8.dylib.
And MacPorts is likely to install that library into "/opt/local/lib/" instead of "/usr/local/libodep/". Not sure if LibreOffice is smart enough to know what to do in that case but you can do a symbolic link from a file in one directory to a sym link in another directory in a pinch if you're desperate.
I came across the same issue as:
dyld: Library not loaded: /usr/local/lib/libintl.8.dylib
Referenced from:
/opt/local/bin/yasm
Reason: image not found
Trace/BPT trap: 5
I had to install MacPorts and gettext, which installs the libintl.* libraries in /opt/local/lib
MacPorts defines the dependency of yasm on gettext
You'll find the same topic here for followup:
https://github.com/dagwieers/unoconv/issues/125
Though the provided answers didn't work for me, installing macports didn't work for me,
libintl.8.dylib I didn't find on /opt/local/lib/
I found others have the problem not being compatible.
gettext also didn't work for me.

Problems building node.js on Cygwin, please help

I'm trying to get node.js running on Windows 7. I have no experience with Linux so I've just been blindly following instructions from tutorials I've found, but I'm still unable to build node.js.
What I did:
Install Cygwin - the entirety
Attempt to build node.js
This is the error I first got:
I then followed the commands of two other similar sites and they all resulted in this error (could getting several version of node have caused me more problems? I'm completely clueless on this).
I read somewhere that the Windows version of Python could be causing the problem so I uninstalled my Python 2.7 and added C:\cygwin\bin to the PATH.
That still didn't work and I read somewhere else that I'm supposed to rebaseall so I tried that, but I also got an error for that:
That's where I'm at now. Have any steps I've taken exacerbated the situation?
Add -e '/\/sys-root\/mingw\/bin/d' at line 110 in /bin/rebaseall file.
Then re-run rebaseall -v and you shouldn't get the error anymore.
See this pretty helpful blog posting - Node on CygWin doesn't work for Node v0.2.5. Use the latest v0.4.0 version instead.
Also consider the post's recommendation of compiling against MinGW instead of in CygWin.
First of all, why did you check out such an old release v0.2.5? When I did it a few weeks ago I just took the latest and ended up with 0.5.0pre, but it would also be reasonable to specify v0.4.3. For instance, type git clone git://github.com/joyent/node.git to download node, and then:
cd node
./configure
make install
Secondly, do not rebase by running ash from the CYGWIN shell. Instead, shutdown all Cygwin processes, then use Windows explorer to open the ash.exe binary. Since I have a Windows 7 system without node.js, I decided to follow my instructions and build. Not so easy. I ran into some wierd dll issues that all went away when I ran ./rebaseall followed by ./perlrebase from the ash prompt. It seems that rebaseall is not sufficient anymore.
Thirdly, there is a message that makes it sound like you don't have a C compiler. Some googling will lead you to sites telling which Cygwin packages you need, but at minimum install the g++ compiler and that should pull in C as a dependency.
When I did this I simply ran configure and every time there was an error, installed one more Cygwin package to supply the missing piece. Even OpenSSL is available.
What I just found is remove the windows based install of Python. After uninstalling this, everything is peachy.
I like cygwin a lot -- but recent releases have become pretty unreliable. Some packages just wont build, and some "standard" apps dont work e.g. gvim's "save as" bombs out on my installation.
A possible solution would be run one of the better Linux distributions (ubuntu, fedora, suse etc.) either as a virtual machine or a dual boot setup and do the build inside linux.

Categories

Resources