ImportError: No module named 'kivy' - python-3.x

I have 3 Projects:
The weather app from the Book "Creating Apps in Kivy" that i have completed.
A StudentDB app from a Youtube Tutorial.
The beginning of my own app.
The first two still work. But if i want to build my own, kivy is not known.
I have thrown everything out but the basics. I do not know why kivy only runs for project my first projects. I had no issue with the other ones. But i cannot escape the issue.
I have tried pip install kivy but it is already installed, i do not know the version though.
I use Python 3.5.6 in the Anaconda bundle.
I have tried making a new Project and abandoning my old.
Begin of code i used
from kivy.app import App
class BasicApp(App):
pass
End of code i used
Does anyone know this issue? Do i have to install something special? I am not sure how to handle this one.

Related

Cloud Firestore for android apps built in Kivymd not working with buildozer

Me and a friend are creating android app in Kivymd. We did create a database using firebase.
But we used the firestore option than the realtime database. We really like the feature and want to keep it. Everything works fine when we compile the app on our Ubuntu environment. But when we add firebase-admin in our requirements in the buildozer.spec file we get alot of errors related to google-cloud, google-protobuf and the list goes on. We have been looking everywhere on the internet but we cant find a solution. And all of these packages are installed with pip and we have verified this.
When using our original requirements string such as:
requirements = python3,kivy==2.0.0rc3,kivymd,sdl2_ttf==2.0.15,android,plyer,requests,urllib3,chardet,idna,hostpython3
Everything works fine, but when we add firebase_admin to the requirements we get No module errors that makes the requirements string getting very long. And we have installed everything u can possibly think related to the google packages with pip.
We have been exploring on maybe creating our own recipe, but we would be very happy if anyone could just lead us in the right direction. Our current requirements string is so long that i wont post it here. We have made realtime database work because it only uses requests so maybe we need to skip using firestore. Below are the packages we use to use and are the root cause of why the app does not work in the android app with buildozer.
import firebase_admin
from firebase_admin import credentials, firestore, exceptions
I have a feeling we must create a recipe or that its not even possible to use with kivymd and android. But any help would be very appreciated.

Shared library from Create React App projects giving (jsx isn't currently enabled error)

I'm attempting to use a shared library for reusable components and using just 2 out of the box Create react apps. One is called 'shared-lib' the other 'project-example'. I made a super simple component in shared-lib, exported (working when I test). I NPM linked both seemingly correctly (shared-lib is in my project-example node_modules with a special icon).
I built the shared-lib, I also imported the shared component (SharedComponent)
import SharedComponent from 'shared-lib'; <- lib is in my node_modules
../shared-lib/src/index.js
SyntaxError: /Users/bemker/dev/portals-modern/shared-lib/src/index.js: Support for the experimental syntax 'jsx' isn't currently enabled (8:3):
Add #babel/plugin-transform-react-jsx (https://git.io/vb4yd) to the 'plugins' section of your Babel config to enable transformation.
I'm following a vid tutorial and he didn't have to eject his create react app, but I'm guessing this is where the error is coming from.
Here is the vid I'm following if anyone wants to take a look. https://www.youtube.com/watch?v=B7iYJT_ll-U
Anyone know why this is occurring, or how to get past it (preferably without ejecting)?
I couldn't find a solution using the above, but there is a package similar to Create React App for building libraries that made it pretty easy. Its not maintained by FB, but it worked for me.
https://github.com/transitive-bullshit/create-react-library
https://github.com/transitive-bullshit/react-modern-library-boilerplate (multiple exports)
vid tutorial using it: https://www.youtube.com/watch?v=N8d-CLmg3hw
second w/ 'real' usage: https://www.youtube.com/watch?v=6R699AQYH74
Hope this helps someone.

lxml library in AWS Lambda

I've included this library as a layer to my lambda function but when I go to test it I get the error: cannot import name 'etree' from 'lxml'
There are multiple posts about people having this issue and some say to that I need to build it to compile some c libraries. Most posts say to look for another file or folder name 'lxml' which I've verified is not the issue.
I'm able to run the same code I've deployed to my layer on my local linux workstation and it runs without an issue.
Turns out my lambda was running python version 3.8 and that version is not compatible with the version of lxml I am using 4.5.1. Changing the run time to 3.7 fixed the issue. Hope this helps someone.

Missing libraries/modules from Perfect framework on Linux

I am a newbie learning how to code in Swift on Linux.
Right now I am trying to use Perfect framework so I can create th REST service (or something like that) I am following instructions in this
https://videos.raywenderlich.com/courses/77-server-side-swift-with-perfect/lessons/1
video (I have found a link on perfect.org site) and I did everything just like in the video, but the problem occurs when I have to edit the main.swift file and use include to use the PerfectLib, PerfectHTTP and PerfectHTTPServer libraries/modules(?). When I run it the error shows on the terminal saying:
main.swift:1:8: error: no such module 'PerfectHTTP'
import PerfectHTTP
Same with other modules. Do I have to place downloaded files from Perfect to some special directory within swift directory? Or maybe the files in download link are not complete?
before doing any Server Side Swift, please temporarily forget Xcode and try a new tool chain called Swift Package Manager. Open a terminal in a blank folder and type swift package init then it will setup a blank project which contains a Package.swift, a folder named Sources and a Tests directory as well.
Now you have to edit the Package.swift before import anything into your source code. For example, the starter template Perfect server has such a Package.swift:
import PackageDescription
let package = Package(
name: "PerfectTemplate",
targets: [],
dependencies: [
.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2)
]
)
Then you can import any Perfect libraries included in the Perfect-HTTPServer.git
Here is the importing part as defined in the main.swift of PerfectTemplate:
import PerfectLib
import PerfectHTTP
import PerfectHTTPServer
So I will suggest that the best practice is to try Perfect Assistant: https://assistant.perfect.org/perfectassistant/Perfect%20Assistant.dmg which can save most tricky operations such as dependency management, building on linux and production server deployment.
For more information about Perfect other than tutorial video, see this link: http://www.perfect.org/docs/

Trouble importing HTTPTokenAuth from flask_httpauth

I am trying to use token authentication for a Flask project.
from flask_httpauth import HTTPBasicAuth # works
from flask_httpauth import HTTPTokenAuth # does not work.
I get the following error
ImportError: cannot import name HTTPTokenAuth
I tried
pip install flask_httpauth --upgrade
But it claims everything is up to date. (Flask-HTTPAuth==3.1.1)
The docs suggest this is the proper way to import it, but for some reason it is not working. Any ideas how I can get the token auth to import?
Edit:: I deleted and recreated the virtual environment I was using.
I am using python anywhere.
The problem persists. I discovered an older version of Flask_httpauth is loaded by default (v2.2.0 instead of v3.1.1). I went into the site packages and saw the HTTPTokenAuth is there and should be called.
I tried doing
import flask_httpauth
print (flask_httpauth.__version__)
to check the version being called by my app, but that doesnt work for all python packages, and it seems flask_httpauth doesnt have that functionality.
There are no errors displayed where I have the virtual enviorment linked on the web tab of pythonanywhere.
PythonAnywhere dev here, just reposting the solution that was discovered from #ExperimentsWithCode's forum post. The problem was happening when the code was being run from the editor on PythonAnywhere. This is separate from the configuration that is done on the "Web" tab where the virtualenv was specified: people can run any code they want from the editor, regardless of which web app it's associated with, or even code that's not associated with a web app.
So the solution was what #Miguel suggested: use a shebang.

Resources