PYTHONPATH environment variable - environment-variables

My virtual-environment worked perfectly until I upgraded to Ubuntu 22.04 LTS.
But when I upgraded the virtual environment is not working any longer.
It gives this message:
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
I did activate it as I used to do before, with
workon myenvironment
and I tried also with
source myenvironment/bin/activate
but none of them seems to work. I get always the same message.
I deleted the environment and created a new one but I still get the same message.
And Django is also installed, so the only missing thing I haven't check is the PHYTHONPATH environment variable, but I do not know if I could change it somehow and even if I would know it, I wouldn't know what should it look like.
What should I do to fix this?
Do I have to do anything special after upgrading to Ubuntu 22.04 LTS to keep my virtualenvironments working?

Even when on ubuntu 18 before running the server with:
python3 manage.py runserver
I had to activate virtualenvironment with:
workon myenvironment
With Ubuntu 22.04 it seems it is not necessary and runserver will work without activating virtualenvironment. I don't understand why, but it works.

Related

How to install wkhtmltopdf for docker

I'm using wkhtmltopdf for nodejs, followed instructions for windows installation (and added it to PATH after installation). When i start my app through bash, it works just fine as it should. I manage to convert html to pdf.
But it doesnt work when im using docker, like it doesnt even exists. Im assuming there is some other way to install it for docker, or some way to add PATH to docker?? Any other ideas? hints?
And before u say it, been googling it and looking for images and installations for docker, none helped. Got one that u know it works?
Anyways for all the others that found themselves in the same pickle... I was trying to use wkhtmltopdf within docker container while wkhtmltopdf was only installed and executable within system (windows/linux) environment and not in the actual docker environment... after updating dockerfile to automatically install wkhtml with the build, I also had to SET THE PATH.. for linux docker smth like this
cp wkhtmltox/bin/* /usr/local/bin/ &&
that made everything works just as it should.

Installing Apache Airflow on Amazon Lightsail Instance

So i figured out the basics of Apache Airflow and I can run dags/tasks on my computer (so sleek!). However, I want to be able to have these run when my computer's off - so I bought a $5/month Lightsail instance and tried to install Airflow on there pip install airflow.
I keep getting the attached output. It seems as though there isn't enough memory on the instance to finish the command or something but I feel like if that were true, it would output an error message...
Thoughts?
I've found an answer to my own question. I tried out the solution provided for this question, and it worked:
First - I created a virtual environment and entered it by typing these commands into the command line:
virtualenv my-env,
source my-venv/bin/activate
Second - Once in the virtual environment, instead of inputing pip install airflow, I input pip --no-cache-dir install airflow. This worked to avoid the memory error!

Using pymssql 2.2 not connecting to SQL server

I was using a Macos system install of Python rather than a virtualenv. On this I had installed freetds and pymssql 2.1. This connected fine to a database using:
pymssql.connect(server='the.host.name\instance', user='username' etc . . ).
Realising that virtualenv is the proper way to do stuff I created a python 2.7-based virtual env and tried to pip install pymssql but got an error message. Quick hunt found the fix - namely to install from git with:
pip install git+https://github.com/pymssql/pymssql.git
but now my connection call returns a host-not responding error. I have used tsql to debug (TDSDUMP=stdout) and it looks like the address\instance is causing a problem. Connecting to databases that have an address but no instance works fine
When I revert to my system-wide install and run it, I see that freetds resolves a port number for the database instance to a specific port (portNo).
Under my virtualenv, if I do my call to pymssql using this port number, my connection is fine.
pymssql.connect(server='the.host.name\instance', user='username', port='portNo', etc . . .)
whilst this work around works - I'm guessing that any change on the server might break it.
Any ideas why my pymssql call fails under these conditions?
Explicit is better than implicit. It is best to always include the port number (at least I do).
Review the following two items:
Make sure both installatons of pymssql (the global one and the one you get inside the virtualenv) are actually linked against the same FeeeTDS version. It could be you have more than one FreeTDS version installed and this is the reason you're seeing different behavior.
When the server parameter contains \ characters, make sure you either double quote it ('the.host.name\\instance') or use raw string notation (r'the.host.name\instance'). This is standard Python development practice.

Ejabberd installation strange issue

OS: Debian 8.1 X64
trying to install eJabberd Community server based on this tutorial
At the end of installation, it pops error message
Error: Error running Post Install Script.
The installation may have not completed correctly
What am I doing wrong?
It looks like /bin/sh is Dash on your system (apparently the default since Debian Squeeze). However, the postinstall.sh script inside the package uses brace expansion, which while widely supported in various shells is not required by the POSIX standard, and thus Dash is not in error by not supporting it. The postinstall.sh script should either specify /bin/bash instead of /bin/sh in its first line, or abstain from using Bash-specific features.
You should be able to get a functioning ejabberd install by explicitly running the postinstall script with Bash:
sudo bash /opt/ejabberd-15.07/bin/postinstall.sh

rails s command does not run from ssh

I am using Putty to connect to my localhost, and I don't have any problems apparently, however, when I run command rails s to start my rails 4.0.0 application from Putty, it gives me this message:
jose#jose-laptop:~/rails/dedicated-agenda$ rails s
The program 'rails' can be found in the following packages:
ruby-railties-3.2
ruby-railties-4.0
Try: sudo apt-get install
I don't get that message from the terminal though, the application starts running just fine.
I had to reinstall ubuntu so I upgraded to ubuntu 14.04 just in case you need to know.
I don't know if I am missing something in my ssh settings or how could I use rails s from Putty.
Thanks in advance.
Your PATH environment variable is set differently when you are executing programs in an interactive shell and by ssh(using putty).
Use absolute path of the program to not depend on the PATH variable.
You can also set the right PATH variable at ~/.profile file and load the updated variables using the command source ~/.profile.
Now, you should be able to run the command.
You can use the command
>which rails
to see where rails is installed on your working session.
Then you need to make sure that is in your path when you ssh in.
If you are ssh'ing in as a different use then that user may not have permission to see the rails executable.

Resources