linter pylint is not installed vscode - visual-studio-code

I know there are multiple version of this question on SO, I've tried the solutions posted on those threads and they don't seem to help :(
I have VS Code installed in an Ubuntu VM. I can't seem to get the python linter to work. i.e. I get a message saying
Linter pylint is not installed
I am pretty sure pylint is installed on the VM because when I run which pylint I have a valied output.
Here are the outputs for which python and which pylint respectively
/usr/bin/python
/home/rakshak/.local/bin/pylint
And I have the following in my User settings and workspace settings in VS Code
// Place your settings in this file to overwrite the default settings
{
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/home/rakshak/.local/bin/pylint",
"python.pythonPath": "/usr/bin/python"
}

So, turns out this was just a permissions issue!
When I got the pylint not installed message, I was presented with a button to "Install pylint" this runs
sudo pip install pylint
This changed the owner of my .local/lib/ to root and made it inaccessible to vscode.
Output of ls -ld ~/.local/lib/ was
drwx------ 3 root root 4096 Sep 24 10:49 /home/userName/.local/lib/
Runing chown with my group and user fixed this issue.
sudo chown -R group:user ~/.local
now the output of ls -ld ~/.local/lib/ reads
drwx------ 3 userGroup userName 4096 Sep 24 10:49
/home/rakshak/.local/lib/

Have you checked with which python version you have installed pylint?
If you have used python 3.6 then the setting has to be like this:
"python.pythonPath": "/usr/bin/python3.6"

Related

Unable to configure a new agent : Failed to create CoreCLR, HRESULT: 0x80004005

We had some 12 agents (vsts-agent-linux-x64-2.188.4) running on one Az VM (Ubuntu 20.04.2 LTS) as processes (./config.sh && screen ./run.sh). All was well..
I had to run some command related to /tmp folder but it kept showing busy and we suspected that our Agents might be using /tmp. Unfortunately instead of any other clean way of stopping the agents, we killed all processes on this VM manually, including the agents'.
After the /tmp related command ran successfully, I tried running screen ./run.sh from one of the agent directories. And I got an error:
Failed to create CoreCLR, HRESULT: 0x80004005
I also had tried :
.agent2/run.sh and I got the error :
ldd: ./bin/libcoreclr.so: No such file or directory
ldd: ./bin/System.Security.Cryptography.Native.OpenSsl.so: No such file or directory
ldd: ./bin/System.IO.Compression.Native.so: No such file or directory
ldd: ./bin/System.Net.Http.Native.so: No such file or directory
Failed to create CoreCLR, HRESULT: 0x80004005
I even downloaded a new .tar for the agent and ran a fresh ./config . But I get the same error on ./config as well
Is there a solution to this? Please help
export COMPlus_EnableDiagnostics = 0, and then running ./config from the agent directory. worked!
I had this issue when running as the non-privileged user specified in the systemd file but running as root user worked fine.
Finally used:
strace -f -o trace.log /<executable path>/<executable name>
Which led me to:
9183 mknod("/tmp/clr-debug-pipe-9183-8112345738-in", S_IFIFO|0700) = -1 EACCES (Permission denied)
This caused me to compare the /tmp directory between working and non-working boxes.
[<not-working-hostname>]$ ll /
drwxrwxr-x 7 root root 93 Jan 5 21:37 tmp
[<working-hostname>]$ ll /
drwxrwxrwt 7 root root 93 Jan 5 21:59 tmp
(Note the r-x vs rwt)
Fix:
[<hostname>]# chmod 1777 /tmp

raspistill returning file not found

I am trying to use the 64 bit version of raspbian (which can be found here: https://www.raspberrypi.org/forums/viewtopic.php?f=117&t=275370
I downloaded it, installed everything, ran my updates and then switched on the camera. But when I try to run it, the PI just gives back
bash: /opt/vc/bin/raspistill: No such file or directory
When I do a ls, I can see the directory fine:
pi#raspberrypi:/opt/vc/bin $ ls
containers_check_frame_int containers_test dtoverlay-pre raspiyuv
containers_datagram_receiver containers_test_bits dtparam tvservice
containers_datagram_sender containers_test_uri edidparser vcdbg
containers_dump_pktfile containers_uri_pipe mmal_vc_diag vcgencmd
containers_rtp_decoder dtmerge raspistill vchiq_test
containers_stream_client dtoverlay raspivid vcmailbox
containers_stream_server dtoverlay-post raspividyuv vcsmem
and when I look at the permissions, there are read/execute permissions for everyone:
-rwxr-xr-x 1 root root 142397 Nov 1 16:25 raspistill
Im at a bit of a loss here - the file is right there, so why is it not being found when I try to call it from the command line?
Unfortunately, it looks like MMAL userland still (at the time of writing this) has some unresolved issues with 64bit raspberry pi OS, so it is disabled.
However, one can use docker or cherry-build 32bit packages as workarounds.

Can't install scala in emacs - An error occurred while loading `/home/nazar_art/.emacs'

I tried to install Scala accord this Set up for learning Scala with Emacs.
My current OS is Ubuntu 12.04.
I did exactly step by step.
After installation I run Emacs and see next error:
Warning (initialization): An error occurred while loading `/home/nazar_art/.emacs':
File error: Cannot open load file, scala-mode-auto
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I guessed that it is problem with permission. I change it for scala-mode but without success.
Here is content of ~/.emacs.d:
nazar_art#nazar-desktop:~/.emacs.d$ ls -lg
total 12
drwx------ 2 nazar_art 4096 Oct 10 10:58 auto-save-list
drwxrwxr-x 4 nazar_art 4096 Oct 5 00:12 elpa
drwxrwxrwx 4 nazar_art 4096 Oct 10 10:41 scala-mode
I'm newly at emacs and not sure that can find cause of error follow my intuition.
Any suggestion?
How to solve this trouble?
This worked for me:
Install Scala
sudo apt-get install scala
Get scala-mode
cd ~/git
git clone git://github.com/tuxdna/scala-mode.git
Set up the load-path
(add-to-list 'load-path "~/git/scala-mode")
Require scala-mode-auto
(require 'scala-mode-auto)
Created my first Scala source ~/first.scala. The mode was loaded.
object First {
def main(args: Array[String]) {
println("Test")
}
}
M-x scala-run-scala
Loaded the source with C-c C-l.
Entered First.main(null) in the interpreter. The program ran.

Capifony and directory owners

When I cap deploy my Symfony2 project, then log into my server I see that the the dev (app_dev.php) runs ok but the prod version (app.php) does not.
The error is
[Tue Jan 03 14:31:48 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/example/prod/releases/20120103202539/app/cache/prod/classes.php".' in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache:1079\nStack trace:\n#0 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(1017): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::writeCacheFile('/var/www/example/p...', '<?php ????name...')\n#1 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(682): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::load(Array, '/var/www/example/p...', 'classes', false, false, '.php')\n#2 /var/www/example/prod/releases/20120103202539/web/app.php(10): Symfony\\Component\\HttpKernel\\Kernel->loadClassCache()\n#3 {main}\n thrown in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache on line 1079
Looking at the recently deployed cache directory I see:
drwxrwxrwx 4 root root 4096 Jan 3 14:28 .
drwxrwxr-x 5 root root 4096 Jan 3 14:28 ..
drwxr-xr-x 6 www-data www-data 4096 Jan 3 14:28 dev
drwxrwxr-x 7 root root 4096 Jan 3 14:28 prod
I can fix the issue with chown -R www-data.www-data prod/ but I wondered if I can stop this from happening in the first place? And why do the directories have different owners?
This happens because your web-server is running by user, who is not able to write to just created cache/prod directory.
There are two solutions, which I know and use. First, add extra commands to run after deployment to Capfile. Capfile will like this:
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/bundles/*/*/recipes/*.rb'].each { |bundle| load(bundle) }
load Gem.find_files('symfony2.rb').last.to_s
after "deploy:finalize_update" do
run "sudo chown -R www-data:www-data #{latest_release}/#{cache_path}"
run "sudo chown -R www-data:www-data #{latest_release}/#{log_path}"
run "sudo chmod -R 777 #{latest_release}/#{cache_path}"
end
load 'app/config/deploy'
Second solution is more elegant. You specify correct user, who can write to cache in deploy.rb and make sure that you don't use sudo:
set :user, "anton"
set :use_sudo, false
In the last version of capifony, they've added the option to set writable directories.
Here's the official article which explains what I've written below : http://capifony.org/cookbook/set-permissions.html
You have to deploy using sudo (not a good practice, but it gets the job done)
set :use_sudo, false
# To prompt the sudo password
default_run_options[:pty] = true
and tell capifony which files to make cache and logs folder writable :
set :writable_dirs, ["app/cache", "app/logs"]
set :webserver_user, "www-data"
set :permission_method, :acl
(you have to install acl on your machine, or use :chwon instead of :acl)
EDIT :
I've just realized that this is not enough, the "set_permissions" task is not automatically called, so you have to explicitly run
cap deploy:set_permissions
Or add this line in your deploy.rb :
before "deploy:restart", "deploy:set_permissions"
I solved this problem by adding cache folder to shared folders.
set :shared_children, [app_path + "/cache", app_path + "/logs", web_path + "/uploads", "vendor"]
This way the directory is not recreated each time during deployment, so there is no problem with permissions.
Yes, don't need recreate cache every time after deploy, this solution is logical and pragmatical.
Second solution from Anton - is work if you cache folder permission true in develop environment

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.