sbt command not found - scala

I am installing sbt in my cloudera distribution.
I have downloaded sbt.0.13.15
Moved file to /usr/local
Then I had updated profile
sudo nano profile
Added export PATH=$PATH:/usr/local/sbt/bin
Saved file and exited.
But now if I issue "sbt about" command, I am getting sbt: command not found.
Could you please help to resolve this issue.

Some suggestions:
Check your PATH variable: echo $PATH
The PATH variable is not updated automatically by writing into .profile, either open a new shell or do source .profile
The file is called .profile, not profile

Related

How to fix 'zsh: command not found: pytest'?

I have python3 and pip3 installed. I also install pytest but when I enter the command pytest, it does not work. It shows me the following:
<zsh: command not found: pytest>
How do I fix this please?
You need to specify the location of the pytest executable—the program that executes pytest—to your computer in order to use the pytest command.
You can do this by adding the directory path where the pytest executable is located to your computer's list of locations it should search for applications.
The PATH environment variable is the name given to this list.
You may use your computer's settings to update the PATH environment variable or you can execute a program in the terminal to add the path of the directory containing the pytest executable to it.
Your computer should then will be able to locate and launch pytest once the PATH environment variable has the path to the directory containing the pytest executable.

How to fix diesel_cli link libpq.lib error with Postgres tools installed in Docker?

I'm trying (for hours now) to install the cargo crate diesel_cli for postgres. However, every time I run the recommended cargo command:
cargo install diesel_cli --no-default-features --features postgres
I wait a few minutes just to see the same build fail with this message:
note: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: aborting due to previous error
error: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `C:\Users\<user name here>\AppData\Local\Temp\cargo-installUU2DtT`
Caused by:
could not compile `diesel_cli`.
I'm running postgres in a docker container and have the binaries on my C:\pgsql with the lib and bin directories both on the PATH so I can't figure out why it's not linking. What else could be required they didn't mention in the docs?
In my case the installation was successful but when I tried to run it this error occured.
maybe this would work for others who have the same problem:
open PowerShell
type in setx PQ_LIB_DIR "C:\Program Files\PostgreSQL\13\lib" (or any other path to your PostgreSQL lib)
restart your PC
run again
I had the same issue with WSL, if you're on Linux probably you could find PostgreSQL lib location and add it to your environment variables.
Update:
The answer below is a work around for older versions. Please check the possibility to execute cargo clean first
Original Version
Adding the folder to the PATH variable didn't help, at least in my case, as by some reason it is not used in the /LIBPATH parameter passed to link.exe.
In my case it was C:\Users\<username>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
You can see it in the beginning of the error message.
Copy libpq.lib in there and it will be used from there.
After installation diesel would require some other assemblies. Copy libcrypto-1_1-x64.dll, libiconv-2.dll and libssl-1_1-x64.dll into the folder showed after where diesel command execution
I had the same error on Ubuntu and for me the following install fixed the issue:
sudo apt install libpq-dev
No need to move files around, just add C:\Program Files\PostgreSQL\14\lib and C:\Program Files\PostgreSQL\14\bin to your PATH. Installing and running diesel should have no problems.
Note: your paths may be different, and remember to close/reopen your terminal so the PATH variable is updated.
(Tested on Windows 10)
To give clear steps for windows:
Add C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib in the path in environment variables
Copy libpq.lib that is in C:\Program Files\PostgreSQL\14\lib (obviously this is with version 14) and paste it in C:\Users<username>.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
If you've attempted to cargo build (or anything that runs the build scripts for libpq rust crate) when your environment was invalid, then you need to do a cargo clean after fixing your environment otherwise you'll still get the libpq.lib not found error even when it's in your PATH. The other answers where you copy the file into another directory are just hacks
You can instead add the path to .../lib to the compilers' library search paths, using RUSTFLAGS environment variable. It works both for installing diesel_cli and for building your projects.
RUSTFLAGS='-L /usr/local/pgsql/lib' cargo build
On Windows with EDB installer, the path contains a space, so use CARGO_ENCODED_RUSTFLAGS instead. For PowerShell:
$env:CARGO_ENCODED_RUSTFLAGS = "-L`u{1f}C:\Program Files\PostgreSQL\14\lib"

Can't init Scala Gradle project: -bash: gradle/gradle-5.2.1/bin/gradle: No such file or directory

I just installed Gradle, manually by downloading the zip and then unzipping it, and verified it installed fine with gradle -v .
I have it located at Users/username/gradle/ . I set it on the home path for linux by running this line:
export PATH=$PATH:gradle/gradle-5.2.1/bin/
However, when I try to init my first Scala project, I run this command:
gradle init --type scala-library
However, it complains that:
-bash: gradle/gradle-5.2.1/bin/gradle: No such file or directory
So fine, I check my directory structure, and that file is definitely in there. What gives?
You should check whether gradle file exists and is an executable ls -l gradle/gradle-5.2.1/bin/gradle. Also if Users/gradle/ means user's home directory shouldn't your path be something like $PATH:$HOME/gradle/gradle-5.2.1/bin/ ?

CMake install directory permission

I have built a project using cmake (LLVM project) and tried to install it by issuing the following command:
$ cmake3 --build . --target install
If I run it using root then there is no problem and the files will be installed under the directory /usr/local/.
My problem is when I want to install the project using normal user.
I get the following error:
CMake Error at cmake_install.cmake:36 (file):
file INSTALL cannot set permissions on "/usr/local/include/llvm"
I have changed the permission of directory /usr/local/ to 777 recursively, and their ownership to root:wheel and I added my normal user to group wheel. But I still cannot install the files into the /usr/local/ directory.
The main issue is about building project in Eclipse which fails at "Build Install" command.
chmod 777 -R / is a very scary command. I've destroyed a system once by doing that.
The philosophy I use for this is:
If I need to deploy something through my IDE to debug or test before packaging, I deploy it locally within my home directory.
I only install stuff to my system (outside of home) if it has been packaged first (*.deb, *.rpm, *.tar.gz) so that I can remove it without problems.
For me, I do this with:
cmake $src
cmake --build . --target install -- DESTDIR=stage
This will configure my project, make it, then install it locally in a folder called ./stage which resides in my build directory. I can then run my executable from ./stage/usr/bin. Note that this only works if make is your generator.
Once I've tested it and I'm happy, I package it and deploy to my system or upload to a repository:
cpack
sudo dpkg -i <package>.deb
We should use USE_SOURCE_PERMISSIONS in our install function.
Example:
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Release/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" USE_SOURCE_PERMISSIONS)

Error from Zookeper 3.4.6 version

I downloaded zookeeper-3.4.6.tar.gz and while executing zkServer.sh start , I am getting below error.I did google but couldn't find a solution, Please let me kno if you see similar issues.
CLASSPATH=/home/spanda20/zookeeper/bin/../src/java/lib/*.jar:/home/spanda20/zookeeper/bin/../conf:
zkServer.sh: 81: /home/spanda20/zookeeper/bin/zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")
Finally I am able to see storm UI and its running.
Below changes I did in the .bashrc file. Please make sure that You add bin path in the PATH VARIABLE.
I did add the below variables in the .bashrc file.
export JAVA_HOME =JDK Path
export ZOOKEPER_HOME =Zookeper install path
Then add them in the variable path.
PATH= $PATH:$JAVA_HOME/bin:$ZOOKEPER_HOME/bin
Thanks
Sanjeeb
I'm using zookeeper version 3.4.9 on ubuntu 14.04 and installed openjdk 7. I have added below lines to ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export ZOOKEEPER_HOME ="/path/to/zookeeper"
PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin.
First I ran sh /path-to-zookeeper/bin/zkServer.sh start but didn't not work I got the same error.
I ran it with sudo /bin/bash /path-to-zookeeper/bin/zkServer.sh start it worked.
./zkServer.sh start
This should work.
Edit /etc/environment, and paste the following:
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"
modify the JAVA_HOME as per your local Java version.