can i add pipenv in a path ? and how to do it? - pipenv

I tried to install pipenv but I always get this problem and message that pipenv is not recognized , I uninstalled it and tried to install it again but I get get same issue

Related

Could not run the `identify` command. Please install ImageMagick

I am using Paperclip and getting this error on the deployed site, not on my local server. And that's why it is becoming more difficult for me to get out of this.
A Paperclip::Errors::CommandNotFoundError occurred in images#update:
enter code hereCould not run the `identify` command. Please install ImageMagick.
I have tried these solutions but was not able to fix this (For ubuntu):
Ran apt-get install imagemagick
I don't use brew. So, won't be able to use brew install imagemagick
Added and deployed these lines to paperclip_options.yml
:image_magick_path: '/opt/ImageMagick/bin'
:command_path: '/opt/ImageMagick/bin'
Can anyone suggest how to resolve this error?

Yarn install says up to date, yet can't start rails console

I've been developing an app using Webpack, Vue.js and Rails. No problems for two months, but out of nowhere when I try to start rails console rails c, yarn complains that packages out of date:
error An unexpected error occurred: "Unknown language key integrityNodeDoesntMatch".
info If you think this is a bug, please open a bug report with the information provided in "/Users/maksimfedotov/vras/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
========================================
Your Yarn packages are out of date!
Please run `yarn install` to update.
========================================
Yet when I run yarn install:
yarn install v1.3.2
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.71s.
I've been looking through yarn and webpacker documentation, tried various yarn cleanup commands, but no luck.
Interestingly enough, I can still run the server, its only console that complains.
This is an old issue, which has been resolved, so I am writing down what I did in the end:
Simply deleting node_modules usually solves the issue. If you are using spring, it also can mess this up, so consider running DISABLE_SPRING=1 rails s to see if that helps
Try restarting spring by running spring stop.
This fixed the issue for me, and meant I didn't need to constantly prefix commands with the spring disable flag.
The above command stops spring: to check that it automatically restarted, run spring status.
Credit to this comment on GitHub for the solution!
You can add in the config/environments/development.rb
this configuration setting
config.webpacker.check_yarn_integrity = false
It also it forget to check yarn integrity on every rails call, as migrations, launching consoles ..., in development environment
This problem resurfaced in April 2021 due to compatibility issues between node-sass and node version 16. (I had similar problems here and provide a similar answer to that below here).
So my solution is to downgrade node until version 16 is fully compatible.
Install node 14 with nvm install 14, then set it to the global default with nvm alias default 14.
Then:
Stop your rails server if it's running
Open a fresh new terminal window (so that node --version returns 14.x (not 16)
Run spring stop
Delete yarn.lock
Remove existing node modules with rm -rf node_modules
Check that node --version returns 14. If it doesn't run nvm install 14 again.
Now reinstall modules with yarn install (if you don't have yarn for node 14, install it with npm install --global yarn)
It should succeed!
Restart your rails server, and it will work!
Other useful info:
This github issue - this comment in particular
Try just yarn install then rails c again
If you are switching branches which change yarn.lock and just want to run a rails console without having to keep running yarn install everytime you switch, you can add this to your app/config/development.rb
config.webpacker.check_yarn_integrity = ENV['SKIP_YARN'].nil?
Then when rails complains you can simply do this
SKIP_YARN=true rails c
In my case, this solve the problem.
rm -rf yarn.lock
yarn install
Try this: NODE_ENV=development yarn install

Installed Django but django-admin is not found

I just installed django using pip but when I try to create a new project using django-admin I get "bash: django-admin: command not found".
I tried installing django in a virtualenv but I'm still getting the same error when trying to create a new project.
While I was trying to solve this issue I found this: Installing Django with pip, django-admin not found
The last answer is saying that django-admin may not be on the path. Can anyone explain me please what does this mean?
If I run "find / -name django-admin.py" I get this:
/home/user/.local/bin/django-admin.py
/home/user/.local/lib/python3.5/site-packages/django/bin/django-admin.py
/home/user/django-admin.py
Can anyone give me some help please? Thank you.
You have installed Django using your account instead of sudo
so do the following to resolve this
$ pip3 uninstall django
$ sudo pip3 install django
This is the output
$which django-admin
/usr/local/bin/django-admin
I had the same problem. My "solution" was to call django-admin directly like
/usr/local/bin/django-admin startproject MyProject
I also experienced this error but none of the above works for me.
This is how I got this silly mistake of me. Example,
$ mkdir django_test cd django_test
$ pipenv shell
(django_test)$ django-admin startproject django_test .
zsh:command not found: django-admin
To solve this error: Don't forget to install your django version in your virtual environment first if you are using.
$ mkdir django_test cd django_test
$ pipenv shell
(django_test)$ pipenv install django==3.0.5 # change the version you are using
(django_test)$ django-admin startproject .
Just in case someone is experiencing this issue, you can just install django using apt package manager instead of pip.
I am not sure if this is the best way to do it but it worked for me.
First you need to uninstall the current installation of django. In this case you can run $ python -m pip uninstall Django
Then run $ sudo apt install python3-django
That should fix the issue.

Homebrew error installing tomcat

After installing tomcat on Os x El Capitan using Homebrew I have received the following Warning:
your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set
to /usr/local/Cellar. Your current HOMEBREW_CELLAR location will stop
you being able to use all the binary packages (bottles) Homebrew
provides. We recommend you move your HOMEBREW_CELLAR to
/usr/local/Cellar which will get you access to all bottles."
The command brew services list shows no services installed.
Printenv doesn't show any homebrew variable
It's not clear to me what should I do.
enter link description here
I also encountered this problem, in the end of the page to get accurate help,
brew bundle dump
rm -rf /usr/local/Homebrew/Cellar
brew bundle
I have received a similar warning when I tried to do a brew update.
It did not allow me to update. All I have done to resolve it was do a brew update in going to the /usr/local/Cellar directory.
From what I understand HOMEBREW_REPOSITORY path was modified or went missing when the OS was updated. After the brew update, the message said
Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local
This got me back to my normal brew usage with out a problem.

Error setting up the tesseract OCR in gem in rails

I'm trying to setup the tesseract-ocr gem in my rails environment. I have ran brew install tesseract and then ran a bundle install on the app and that all runs without errors however when starting the app (rails s) the following error is throw:
/Users/xxxx/.rvm/gems/ruby-1.9.2-p290#xxxx/gems/ffi-inline-0.0.4.3/lib/ffi/inline/compilers/gcc.rb:35:in `compile': compile error: see logs at /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.log (CompilationError)
It reference the following log file:
g++ -dynamic -bundle -fPIC -L/usr/local/Cellar/tesseract/3.02.02/lib -I/usr/local/Cellar/tesseract/3.02.02/include -o /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.dylib /var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.cpp -llept 2>>/var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.log
/var/folders/66/pm_j0lp94gvcj0qnlcnsx9pw0000gn/T/.ffi-inline-501/4239dac38f2a721e0dc5b3750d71ce2e6fa4acb6.cpp:1:10: fatal error: 'leptonica/allheaders.h' file not found
#include <leptonica/allheaders.h>
I followed these two issues:
https://github.com/meh/ruby-tesseract-ocr/issues/3 and https://github.com/meh/ruby-tesseract-ocr/issues/21
It talks about setting ENV vars which i have done. I created a test.rb file in the initalizers folder with the following vars set:
ENV['CFLAGS'] = '-I/usr/local/Cellar/tesseract/3.02.02/include'
ENV['LDFLAGS'] = '-L/usr/local/Cellar/tesseract/3.02.02/lib'
However this makes no difference to the error when starting the app.
I don't understand what it means when it says update the headers. I was wondering if someone could tell me exactly what to do to get this working.
Thanks.
Also had the same error. I solved it by installing the dev packages for tesseract and leptonica.
For debian based systems
sudo apt-get install libleptonica-dev libtesseract-dev
For redhat base systems
sudo yum insall leptonica-devel tesseract-devel
That solved the problem for me.
I've fixed this...
Just in case anyone else has a problem here's exactly how it was fixed in mine:
Firstly had to run both:
brew install tesseract
and
brew install leptonica
Then in the Gemfile NOT in an initializer you have to put both paths to the libraries as env vars:
ENV['CFLAGS'] = '-I/usr/local/Cellar/tesseract/3.02.02/include -I/usr/local/Cellar/leptonica/1.69/include'
ENV['LDFLAGS'] = '-L/usr/local/Cellar/tesseract/3.02.02/lib -L/usr/local/Cellar/leptonica/1.69/lib'
Had this issue (OS X El Capitan). Fixed by downgrading tesseract with
brew uninstall --force tesseract
brew install https://raw.githubusercontent.com/Homebrew/homebrew/8ba134eda537d2cee7daa7ebdd9f728389d9c53e/Library/Formula/tesseract.rb
and updating xcode
xcode-select --install

Resources