I have a project class with the following imports:
import android.app.Activity;
import android.app.Fragment;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.Action;
import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
In android studio the following three bring up a 'cannot resolve symbol' error:
import android.support.v4.app.NotificationCompat.WearableExtender;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
Wierdly, the import for NotificationCompat and NotificationCompat.Action in android.support.v4.app are successful
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.Action;
I have tried to use the same imports on eclipse (pointing to the same SDK as android studio) and the same worked and ran without any errors.
I've also tried Minto's solution of invalidating caches/restarting android studio ...my SDK is up to date as at the time of posting. Thanks for any help in advance
Make sure that you put the following entry into your application's build.gradle file to provide the necessary dependencies:
dependencies {
compile 'com.android.support:support-v4:20.0+'
}
The version number is important, if you specify an older version it will be missing the new Notification code for wearables.
Google has moved some of these tools into the standard libraries. For example, WearableExtender is in Android.app.Notification now. Try ditching the import statements giving you problems, and let Android Studio suggest what to import. Lots of Google's guides have outdated or otherwise incorrect code right now, as they have recently rolled out Google Play Services 5 and other official releases of preview products.
Related
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import check_util.checker as checker
from IPython.display import clear_output
from PIL import Image
import os
import time
import re
from glob import glob
import shutil
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow import keras
print('tensorflow version: {}'.format(tf.__version__))
print('GPU available: {}'.format(tf.test.is_gpu_available()))
Error: Session cannot generate requests Error: Session cannot generate
requests at w.executeCodeCell
(c:\Users\ooche.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:320068)
at w.execute
(c:\Users\ooche.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:319389)
at w.start
(c:\Users\ooche.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:315205)
at runMicrotasks () at processTicksAndRejections
(internal/process/task_queues.js:93:5) at async
t.CellExecutionQueue.executeQueuedCells
(c:\Users\ooche.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:329732)
at async t.CellExecutionQueue.start
(c:\Users\ooche.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:329272)
I think this problem has something to do with kernel.
But I can't find a solution, even though I've already reinstalled and restarted.
Please help me solve this problem.
I'm using Python 3.7.10, Tensorflow 2.3
Please try again by restarting the VS code or by changing the jupyter virtual environment (Change kernel for the notebook) while executing this code in VS code.
(I tried the same code as mentioned above in VS code using python 3.7.10 and tensorflow=2.3 and it executed successfully)
Please check this output:
tensorflow version: 2.3.0
WARNING:tensorflow:From C:\Users\Hp\AppData\Local\Temp\ipykernel_6944\127915523.py:16: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
GPU available: False
I have tried all the methods I found on Internet. Here is the screenshot of my heroku builds:
Here are the modules I imported:
import asyncio
import functools
import itertools
import math
import random
import discord
import youtube_dl
from async_timeout import timeout
from discord.ext import commands
from dotenv import load_dotenv
import os
This is the requirements.txt file:
discord.py
PyNaCl==1.3.0
dnspython==1.16.0
async-timeout==3.0.1
python-dotenv
youtube_dl
And I get the following in the heroku logs:
2021-01-04T17:29:40.235769+00:00 app[worker.1]: ffmpeg: error while loading shared libraries: libvpx.so.5: cannot open shared object file: No such file or directory
Where is the problem
Lets assume I have a module say utility.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os
import random
import sys
import threading
import numpy as np
import tensorflow as tf
.....
I'd like to import this in my drive.py. I have it saved in my local directory and have in my first line
from . import utility
Is that possible, to issue a command in terminal to find the non-local modules ( tensorflow, numpy, etc), and install them using pip?
Any workaround would be appreciated.
CS
If you mean that you'd like the command to parse the file's imports and install missing dependancies automatically, then no it is not possible.
There are modules that are not imported with the pip's package name. For example the package facebook-sdk is imported as import facebook, making impossible to deduct the package name from the import.
I can not find import packages localtion.
from simple_cdd.env import Environment
from simple_cdd.variables import VARIABLES
from simple_cdd.exceptions import Fail
from simple_cdd.tools import FancyTerminalHandler
from simple_cdd.utils import run_command,verify_preseed_file,shell_quote,shell_which
It's in the python3-simple-cdd package, which is under:
/usr/lib/python3/dist-packages/simple_cdd
Is Py2exe just not supported for Python3 or is there something wrong with
build_exe my_script.py
The imports I made in my_script.py are as follows:
import os
import sys
import getpass
import hashlib
import platform
import base64
from cryptography.fernet import Fernet
But according to the documentation on Py2exe.org they say that they use an automatic module finder so you needn't worry about specific imports or whatever.
Can't figure out why I keep getting these errors
Unfortunately as of November 2017 there is no Python 3.5 support for py2exe.