'shp2pgsql' is not recognized : command not found error - postgresql

I am trying to import shape file to postgis. I have problem configuring shp2pgsql.
I am getting this error :
-bash: shp2pgsql: command not found
I have read different threads without getting any results like: https://github.com/Homebrew/homebrew/issues/19213
macbook$ locate shp2pgsql
/Library/PostgreSQL/9.3/PostGIS/man/shp2pgsql.1
/Library/PostgreSQL/9.3/bin/shp2pgsql
/usr/bin/shp2pgsql
macbook$ otool -L shp2psql
otool: can't open file: shp2psql (No such file or directory)
I tried to run which command
macbook$ which shp2pgsql
I got nothing .
macbook$ ls /usr/bin/shp2pgsql
/usr/bin/shp2pgsql
First guess was that "shp2pgsql" is not linked. How can I link /usr/bin/shp2pgsql in postgres PostgreSQL when I tried to run :
sudo ln -s /Library/PostgreSQL/9.3/bin/shp2pgsql /usr/bin/shp2pgsql
It says that : : ln: /usr/bin/shp2pgsql: File exists
UPDATE
When I linked shp2pgsql
dyld: Library not loaded: #loader_path/../lib/liblwgeom-2.1.1.dylib
Referenced from: /Library/PostgreSQL/9.3/bin/shp2pgsql
Reason: image not found
When i tried to locate liblwgeom
macbook$ locate liblwgeom
/Library/Caches/Homebrew/Formula/liblwgeom.brewing
/Library/Caches/Homebrew/liblwgeom-2.1.1.tar.gz
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom-2.1.1.dylib
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.a
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.dylib
/Library/PostgreSQL/9.3/lib/postgresql/liblwgeom.la
/usr/local/Cellar/liblwgeom
/usr/local/Cellar/liblwgeom/2.1.1
/usr/local/Cellar/liblwgeom/2.1.1/COPYING
/usr/local/Cellar/liblwgeom/2.1.1/ChangeLog
/usr/local/Cellar/liblwgeom/2.1.1/INSTALL_RECEIPT.json
/usr/local/Cellar/liblwgeom/2.1.1/LICENSE.TXT
/usr/local/Cellar/liblwgeom/2.1.1/NEWS
/usr/local/Cellar/liblwgeom/2.1.1/TODO
/usr/local/Cellar/liblwgeom/2.1.1/include
/usr/local/Cellar/liblwgeom/2.1.1/include/liblwgeom.h
/usr/local/Cellar/liblwgeom/2.1.1/lib
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom-2.1.1.dylib
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom.a
/usr/local/Cellar/liblwgeom/2.1.1/lib/liblwgeom.dylib
/usr/local/Library/Formula/liblwgeom.rb
/usr/local/opt/liblwgeom
Any thoughts how to resolve this problem.

Write echo $PATH in your bash console and tell us what it says.
Probably this can be fixed by
PATH=$PATH:/Library/PostgreSQL/9.3/bin/
export PATH

Related

Osm2pgsql failed due to ERROR: Error loading lua config: ...l/share/lua/5.2/osml10n/get_localized_name_from_tags.lua:1: module 'unaccent' not found

i am using this project from github :( https://github.com/giggls/osml10n/blob/master )
i have completed all the installation steps but when i run this command (:osm2pgsql -G -O flex -d osm -S openstreetmap-carto-hstore-only-l10n.lua ../openstreetmap-carto-de/data/gcc-states-latest.osm.pbf
) i have the following error can anyone tell me how can u fix it.
ERROR (
Osm2pgsql failed due to ERROR: Error loading lua config:...l/share/lua/5.2/osml10n/get_localized_name_from_tags.lua:1: module 'unaccent' not found:
no field package.preload['unaccent
no file '/usr/local/share/lua/5.2/unaccent.lua'
no file '/usr/local/share/lua/5.2/unaccent/init.lua'
no file '/usr/local/lib/lua/5.2/unaccent.lua')

Symbolic linking issue in local postgres instance on MacOS

Having recently upgraded postgresql and gdal using homebrew, I am stuck with a could not load library error when trying to run a GDAL command that creates a connection to a local postgres database:
ERROR 1: ERROR: could not load library "/usr/local/lib/postgresql/postgis-3.so": dlopen(/usr/local/lib/postgresql/postgis-3.so, 10): Symbol not found: _hash_bytes
Referenced from: /usr/local/lib/postgresql/postgis-3.so
Expected in: /usr/local/opt/postgresql/bin/postgres
in /usr/local/lib/postgresql/postgis-3.so
ERROR 1: PROJ: proj_identify: Cannot find proj.db
ERROR 1: ERROR: could not load library "/usr/local/lib/postgresql/postgis-3.so": dlopen(/usr/local/lib/postgresql/postgis-3.so, 10): Symbol not found: _hash_bytes
Referenced from: /usr/local/lib/postgresql/postgis-3.so
Expected in: /usr/local/opt/postgresql/bin/postgres
in /usr/local/lib/postgresql/postgis-3.so
I am confused by the "Referenced from: Expected in:" part
When I check the folder /usr/local/lib/postgresql/ , I see that the postgis-3.so file is symbolically linked to another directory
cd /usr/local/lib/postgresql/
ls -l
returns
...
postgis-3.so -> ../../Cellar/postgis/3.0.3/lib/postgresql/postgis-3.so
How should this error be interpreted and are there any suggestions on further steps to take in this case?

How to solve error on docker:layers_calculator to compute the Merkle tree on private tangle?

I want to setup a private tangle on my own virtual machine with Ubuntu 18.04, 4GB RAM and 20GB memory.
I have follow this instructions: https://docs.iota.org/docs/compass/0.1/how-to-guides/set-up-a-private-tangle. Every command works fine until reach this one: bazel run //docker:layers_calculator.
It shows an error as follows:
Starting local Bazel server and connecting to it...
ERROR: /home/istabraq/compass/third-party/maven_deps.bzl:3:5: Traceback (most recent call last):
File "/home/istabraq/compass/WORKSPACE", line 42
maven_jars()
File "/home/istabraq/compass/third-party/maven_deps.bzl", line 3, in maven_jars
native.maven_jar(<4 more arguments>)
type 'struct' has no method maven_jar()
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'protobuf_deps.bzl': no such package '#com_google_protobuf_deps//': error loading package 'external': Could not load //external package
INFO: Elapsed time: 4.743s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
How can I solve this problem? what I have missed?
read carefully the message given after running bazel installer:
Make sure you have "/home/yourusername/bin" in your path. You can also activate bash completion by adding the following line to your :
source /home/yourusername/.bazel/bin/bazel-complete.bash
You can check with: "bazel info" or "bazel version"
Unfortunately, there are further errors:
https://github.com/iotaledger/compass/issues/142
I have solve this issue by using this commands:
Step 3: Set up your environment
If you ran the Bazel installer with the --user flag as above, the Bazel executable is installed in your $HOME/bin directory. It’s a good idea to add this directory to your default paths, as follows:
export PATH="$PATH:$HOME/bin"
You can also add this command to your ~/.bashrc or ~/.zshrc file to make it permanent.
reference:
https://docs.bazel.build/versions/master/install-ubuntu.html

Operation not permitted(1)

I am doing an iphone app, were my code works fine with out any error, but when i build the code its failing. and i am getting an error like
rsync: rename "/Users/pcmac/Desktop/Digidrive(IPhone)/Build/RestKit/Support/.svn/.format.0FKOPh" -> "RestKit/Support/.svn/format": Operation not permitted (1)
I am getting this error many at a time and finally says:
Command /bin/sh failed with exit code 23
Can anyone give me solution to solve this ?
It seems you've added RestKit via Subversion (SVN). Is this really what you want? Why not get this dependency from CocoaPods or donwload it from RestKit.org as a source package?
I'd suspect the file permissions on .svn/.format.OFKOPh; to check them:
open a terminal window
change to the .svn dir:
cd /Users/pcmac/Desktop/Digidrive(IPhone)/Build/RestKit/Support/.svn/
check permissions:
ls -la .format*
if the permissions are wrong (i.e. you are not allowed to move the file):
chmod 644 .format.OFKOPh

How to set node path for nodejs (Ubuntu)

I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (https://gist.github.com/579814):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
then
git clone git://github.com/isaacs/npm.git
make
make install
so far, so good. However, when I try to install the postgres driver
npm install pg
I get the following:
node-waf configure build || true
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for program pg_config : /usr/bin/pg_config
'configure' finished successfully (0.066s)
Waf: Entering directory `/home/christian/node_modules/pg/build'
[1/2] cxx: src/binding.cc -> build/default/src/binding_1.o
../src/binding.cc:3:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/christian/node_modules/pg/build'
Build failed: -> task failed (err #1):
{task: cxx binding.cc -> binding_1.o}
I've been looking around for setting the node path, although haven't found anything of help so far - probably also because I'm totally new to nodejs, so I'd be happy about any hint.
Now, you have NodeJS installed in your Ubuntu. You should set /etc/environment and load nodeJS path that can be executed by another users. For example:
NODE="/home/ubuntu/local/node"
NODE_PATH="/usr/local/lib/node_modules"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$NODE/bin:$NODE/lib/node_modules"
#PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Do this in bash:
echo 'export NODE_PATH=~/local/:~/local/node_modules' >> ~/.bashrc
before things are fixed you must use node 0.5.1 (you can use gitk to revert the tree to this version)
Auteur: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Auteur du commit: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Parent: 0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (Remove StatWatcher's dep on C++ EventEmitter)
Enfant: 061ce7b0ac370c8a5ae93d95ab7da171cbd488f0 (net_uv: Fix simple/test-http-expect-continue.js)
Branche: master, remotes/origin/master
Suit: v0.5.1
Précède: v0.5.2
Finally remove node::EventEmitter
I had the same problem.
The issue was that I was specifying a old version of PG in my package.js
After I removed the old version dependancy I was able to install PG without issue.