how can I manually install a module in qpython? - pip

I am using qpython as a non-root user and I have googled it up but all recommendations don't work both manually and using pip...I keep on getting errors...
I get erors when I use both:
pip install requests from pip console
and:
import pip
pip.main(['install','requests']) on python console
The error is something like:
cannot fetch base url https://pypi.python.org/simple/
could not find any downloads that satisfy the condition requests
...
if there is a workaround or a fix I would be happy to accept...

Did you use the newest version(>=2.0.7) Installing requests from QPYPI works well in the newest version. https://github.com/qpython-android/qpython/releases

Yes! This fixed my problem once I used the beta v2.1 from
https://github.com/qpython-android/qpython/releases
Google play did not give me the latest version (I had 1.xx)
I was able to use QPYPY to install requests and it automatically installed the required library urllib3.

Related

How to instruct pip to only install dependencies that are newer than the presently installed versions?

I realize that a requirements.txt file can be used to pin the versions used in pip install. Sometimes I don't want to go through all that- and just simply want to protect my installation from downgrades. Is there any way to instruct pip install to do that?
An example: I just installed librosa and it downgraded numpy from 1.24.1 to 1.23.5 . I don't want that behavior to happen unless I explicitly request. On the other hand if there are missing dependencies then please let's grab them.
For this installation of python it is acceptable to take the risk of occasionally ending up with a mismatch due to installing newer versions [ but I don't want older ones].

Fetch Google Places Data using Python

I'm trying to write a short python script which fetches data from Google Places API and exports it as a .csv file.
Unfortunately I'm stuck right at the beginning.
I want to use requests package but my machine cannot find it.
I've installed Python 3.5 on my Mac and when I use pip to install requests it says:
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
But when I run the program I get an import error which says:
ImportError: No module named requests
Do you have any ideas how i can fix this issue?
Thanks in advance.
Much love.
Use python -m pip install requests instead. Your pip installation was probably for a different version.

Why can't SnowSQL 1.2.2 find a version to download?

First thing I do after unpacking the SnowSQL Linux client is try to upgrade it. This has worked very well through at least v1.1.84. Today I downloaded v1.2.2, installed it, and got an error:
$ ~/bin/snowsql -Uv
No snowsql is available for download: url=https://sfc-repo.snowflakecomputing.com/snowsql, version=1.2
The error comes from this download. Has something changed? I get the same error even when I just try to use it with no options at all, or trying to connect by passing my account code and username.
The curl above was missing https and hence gave the wrong impression of 403 forbidden.
Some times due to a caching issue with the downloads it will not autoupgrade. There are two main components, one being bootstrap and the other one being the main snowsql component. The one you see the issue with is the main component (it is auto-downloaded when you run snowsql).
You can force new version download using snowsql -v 1.2.2 as an exmaple.
You can delete/move the .snowsql directory (~/.snowsql or ~/bin/.snowsql) to ensure a new main component version is downloaded by the new bootstrap.
You may also try using the newer versions for which the rpm is available at
https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/index.html
I noticed Snowflake has some weird firewall configs and similar errors can either happen consistently or intermittently.
The only option I'm aware of that can help if it happens consistently is to use --noup flag with your commands. This will not check for snowsql updates of course, but you can always manually download a newer version via your browser(with VPN is needed).

Can't install any GoLang script in Linux

When I try to run any Go script it show me this error
I installed go lang step by step from this link
https://www.tecmint.com/install-go-in-linux/
When I setup go script like this
go get github.com/tomnomnom/waybackurls
I got error like this
github.com/tomnomnom/waybackurls
src/github.com/tomnomnom/waybackurls/main.go:191: u.Hostname undefined
(type *url.URL has no field or method Hostname)
If you are following the guide you linked by copy-pasting commands, you will have installed Go 1.7.3. The function url.Hostname() was added in Go 1.8.
I suggest completely ignoring that guide. Remove /usr/local/go, remove ~/go_projects and undo the path related stuff.
Instead, use the package manager of your OS to install Go.
Most likely, this means you should do either sudo apt install golang (for Ubuntu, Debian, ...) or sudo dnf install golang (Fedora, CentOS, ...).
That will give you the latest version that is supported by distro maintainer (which at the moment is probably 1.11 or 1.12, depending on your distro).
As an alternative to the packagemanager, download the latest version from https://golang.org/dl/.
This approach also gives you an installation that follows the Go ecosystem their conventions for paths (I'm not sure if ~/go_projects was ever a think, but it isn't today).

Django Rest Framework Swagger stopped working

Just tried to rebuild a container with DRF and drf-yasg. The exact same commit was passing all tests fine but is now falling over with the following exception:
ImportError: Could not import 'rest_framework.schemas.coreapi.AutoSchema' for API setting 'DEFAULT_SCHEMA_CLASS'. ModuleNotFoundError: No module named 'rest_framework.schemas.coreapi'.
Nothing else has changed, but it seems a newer package may have been included that broke the Swagger generator.
Anyone else experience similar?
So it seems pip was pulling DRF V3.10, which has some switch from CoreAPI to OpenAPI: https://www.django-rest-framework.org/community/3.10-announcement/ . Adding the line from the release documentation:
REST_FRAMEWORK = {
...
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema'
}
did not seem to make any difference.
I would presume your dependencies in requirements.txt are not specific enough, and rebuilding the container has installed a later version of djangorestframework.
Check for a line in your pipfile like djangorestframework>=3.9, and this should be changed to either pin a specific version djangorestframework==3.9, or pin it to a specific minor release so you will still receive bug fixes and security updates djangorestframework>=3.9,<3.10.
These lines can also be used directly with pip, incase your container build uses pip directly, e.g. pip install "djangorestframework>=3.9,<3.10"
It seems that installing coreapi seperately may help: pip install coreapi
pip3 install packaging
solve it!

Resources